home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Information
/
THINK C Digest
/
1992
/
92-12
< prev
Wrap
Text File
|
1995-12-31
|
118KB
|
3,374 lines
Path: ucivax!gateway
From: kirk_crawford@qmail2.aero.org (Kirk Crawford)
Subject: No Members Defined
Message-ID: <199212010003.AA12884@aerospace.aero.org>
Posted-Date: 30 Nov 92 16:07:57 U
Newsgroups: fa.think-c
Lines: 13
Date: 1 Dec 92 00:03:51 GMT
Subject: No Members Defined
I have some old Think 4 source I am trying to translate. Think 5 is
complaining about the following:
typedef struct
{ sortEntry sortData[];
} sortList;
It says "No Members Defined". How do I translate this so that Think C 5 will
like it?
Path: ucivax!gateway
From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
Subject: No Members Defined
Message-ID: <9212011430.AA09420@chaos.cs.brandeis.edu>
In-Reply-To: Kirk Crawford's message of 1 Dec 92 00:03:51 GMT <199212010003.AA12884@aerospace.aero.org>
Newsgroups: fa.think-c
Lines: 30
Date: 1 Dec 92 14:30:21 GMT
>>>>> On 1 Dec 92 00:03:51 GMT, Kirk Crawford <kirk_crawford@qmail2.aero.org> said:
> I have some old Think 4 source I am trying to translate. Think 5
> is complaining about the following:
> typedef struct
> { sortEntry sortData[];
> } sortList;
> It says "No Members Defined". How do I translate this so that
> Think C 5 will like it?
You're going to have to add a non-zero dimension to your array
declaration. This is due to the fact that C 5.0 (in accordance with
ANSI C) disallows zero sized objects.
The only exception to this rule is that if you have "THINK C
Extensions" on, you will be allowed to declare an array of zero
dimension at the end of a struct, provided that the struct itself has
other members.
I would change the declaration to sortData[1]. You'll need to check
for any use of sizeof() on the above object, although I don't know
what C 4.0 would return for it.
-phil
----
Phil Shapiro Software Engineer
Language Products Group Symantec Corporation
Internet: phils@cs.brandeis.edu
Path: ucivax!gateway
From: kent@centauri.dmc.com (Tom Kent)
Subject: Re: $$$$$$$$$ (not money) $$$$$$$$$$$
Message-ID: <01062011.k5ekh9@centauri.dmc.com>
Newsgroups: fa.think-c
Organization: Sophist Solutions
Lines: 22
Date: 3 Dec 92 01:37:09 GMT
In article <9211231939.aa17031@q2.ics.uci.edu> (dmc.think-c), Andrew McAllister <C511899@mizzou1.missouri.edu> writes:
> Amen, using $ signs in C is very strange, but for some reason Apollo and
> HP really likes using them. In fact almost every function call in Apollo's
> graphics, network, and OS libraries use dollar signs.
DEC originally designated the dollar sign character as a component
in all their system service calls, as a means of avoiding namespace
conflicts with user-written code. Apollo appears to have adopted this
practice, and it is certainly possible that HP or IBM predated DEC
in this regard. Whoever started the trend, the others probably copied
it to improve portability.
Despite the fact that I worked at DEC in the late 70s, I never got used to
it because it is a shift character and because it makes the symbol
name harder to read--my eyes seems to parse it as a delimiter, not a
symbol constituent. But of course that's irrelevant.
--------
Tom Kent Internet: kent@centauri.dmc.com
Sophist Solutions UUCP: ...uunet!thehulk!kent
375 Pond St. CompuServe: 73300.2677@compuserve.com
Dunstable, MA 01827 Office: (508) 649-9968
Path: ucivax!gateway
From: kent@centauri.dmc.com (Tom Kent)
Subject: Re: Virtually everyone...
Message-ID: <01062011.k5fa9b@centauri.dmc.com>
Newsgroups: fa.think-c
Organization: Sophist Solutions
Lines: 29
Date: 3 Dec 92 01:37:09 GMT
In article <9211301732.AA24888@hobbes.kzoo.edu> (dmc.think-c), "Jamie R. McCarthy" <k044477@hobbes.kzoo.edu> writes:
> Does anyone _not_ use the project option "Methods are virtual by
> default?" I've heard that C++ methods are non-virtual by default;
> maybe it has something to do with this?
> Should I start putting "virtual" in front of every method declaration I
> make public?
Yes, it does relate to compatibility with true C++. But no, you shouldn't
put it in front of each public method.
There are two reasons NOT to make a method virtual:
1. Runtime overhead. Making a method virtual implies that runtime
accesses must scan a vtable to choose the right method. If the method
won't ever need to be overridden, don't use virtual. (In true C++
you can designate methods as inline to get better performance, but
"virtual" necessarily disables "inline.")
2. Encapsulation. Sometimes you want a method to be publicly accessible
but you don't want a subclass overriding it because you're class is
the only one responsible for a particular datum or action. By keeping
such methods nonvirtual you get a safer (lower "surface area") class
and somewhat better performance.
--------
Tom Kent Internet: kent@centauri.dmc.com
Sophist Solutions UUCP: ...uunet!thehulk!kent
375 Pond St. CompuServe: 73300.2677@compuserve.com
Dunstable, MA 01827 Office: (508) 649-9968
Path: ucivax!gateway
From: Per.Mildner@csd.uu.se (Per Mildner)
Subject: Re: Virtually everyone...
X-Sender: perm@meryl.csd.uu.se
Message-ID: <199212031316.AA18144@meryl.csd.uu.se>
Newsgroups: fa.think-c
X-Charset: ASCII
Lines: 21
Date: 3 Dec 92 13:16:52 GMT
X-Char-Esc: 29
At 01.37 92-12-03 +0000, Tom Kent wrote:
>There are two reasons NOT to make a method virtual:
>
>1. Runtime overhead. Making a method virtual implies that runtime
>accesses must scan a vtable to choose the right method. If the method
>won't ever need to be overridden, don't use virtual. (In true C++
>you can designate methods as inline to get better performance, but
>"virtual" necessarily disables "inline.")
>
This is not correct. Firstly, vtables isn't "scanned" they are indexed,
i.e., one addition and one dereference to access a particular method (for
single inheritance at least)). Secondly, "virtual" doesn't NECESSARILY
disable "inline", inline expansion can be done when the compiler knows
about the runtime class of an object already at compile time (e.g., stack
allocated objects in local scope). I belive e.g. Borland does this.
Per Mildner Preferred: Per.Mildner@CSD.UU.SE
Computing Science Dept. AppleLink: sw1106
Uppsala University tel: +46 18 181049
Box 311, S-751 05 Uppsala,Sweden fax: +46 18 521270
Path: ucivax!gateway
From: k059509@hobbes.kzoo.edu ("Jason A. Bobier")
Subject: Think C 6.0
Message-ID: <9212031458.AA16569@hobbes.kzoo.edu>
X-Mailer: ELM [version 2.3 PL11]
Newsgroups: fa.think-c
Lines: 16
Date: 3 Dec 92 14:56:09 GMT
Let me see if I have my facts straight.
1. Bedrock is due out at the beginning of next year.
2. Bedrock is going to be a C++ library.
3. Think C 5.04 is not a C++ compiler.
Therefore since Think C and Bedrock are both made by Symentic, more than
likely Think C 6.0 will include a C++ compiler and will be out around the
beginning of next year. :-)
Anyone care to comment?
Jason Bobier
k059509@kzoo.edu
Politics is like beef stew; if you don't keep stirring it up, all of the greasy
scum rises to the top.
Path: ucivax!gateway
From: dickie@math.wisc.edu (Garth Dickie)
Subject: Re: Virtual Functions
Message-ID: <9212031542.AA17308@schaefer.math.wisc.edu>
Newsgroups: fa.think-c
Lines: 20
Date: 3 Dec 92 15:46:32 GMT
Per Mildner writes:
This is not correct. Firstly, vtables isn't "scanned" they are indexed,
i.e., one addition and one dereference to access a particular method (for
single inheritance at least)). Secondly, "virtual" doesn't NECESSARILY
disable "inline", inline expansion can be done when the compiler knows
about the runtime class of an object already at compile time (e.g., stack
allocated objects in local scope). I belive e.g. Borland does this.
Unfortunately, the original writer *was* correct, for Think C. If you
trace through method dispatch, you find that it uses a sort of "vlist".
Each class has a table of pairs, index/method. When you dispatch on an
index, it scans the table for the index. If not found, it then chains
to the parent class, and scans its table for the index.
It appears to be a (questionable, in my eyes) time/space tradeoff. With large
class heierarchies, such as TCL, you could end up with huge amounts of space
taken by vtables. Perhaps as much as 32 or 64K. I would certainly like to
see a vtable option in a future version.
-- garth dickie, dickie@math.wisc.edu
Path: ucivax!gateway
From: jum@helios.de (Jens-Uwe Mager)
Subject: Re: Think C 6.0
Message-ID: <9212031735.AA13972@ibm.helios.de>
Newsgroups: fa.think-c
Lines: 24
Date: 3 Dec 92 17:38:59 GMT
>Let me see if I have my facts straight.
>1. Bedrock is due out at the beginning of next year.
>2. Bedrock is going to be a C++ library.
>3. Think C 5.04 is not a C++ compiler.
>
>Therefore since Think C and Bedrock are both made by Symentic, more than
>likely Think C 6.0 will include a C++ compiler and will be out around the
>beginning of next year. :-)
I suspect they will feature their Zortech compiler, which already is
C++. This is not what I want, but probably their financial controller.
Best Regards,
Jens-Uwe Mager
HELIOS Software GmbH
Lavesstr. 80
3000 Hannover 1
Germany
Phone: +49 511 3681093
FAX: +49 511 3681095
AppleLink: ger.xse0082 Attn: Jens-Uwe Mager
uucp: jum@helios.de or heliosd!jum
Path: ucivax!gateway
From: David.M.Tillinghast@dartmouth.edu
Subject: unsubscribing
Message-ID: <2128498@blitzen.Dartmouth.EDU>
Newsgroups: fa.think-c
Lines: 6
Date: 3 Dec 92 17:55:30 GMT
Hello. I'm sorry for bothering everyone, but I was hoping someone could post
the address to which we must send mail to unsubscribe to this list. It seems
I've lost the original readme.
Sorry for the hassle,
-tig
Path: ucivax!gateway
From: JOSTEISV@dhhalden.no (Jostein Svendsen)
Subject: Programming Quicktime
Message-ID: <MAILQUEUE-101.921204084912.288@sofus.dhhalden.no>
X-mailer: Pegasus Mail v2.3 (R3).
Newsgroups: fa.think-c
Organization: Ostfold College
Lines: 14
Date: 4 Dec 92 07:49:54 GMT
Where can I find the information or sourcecode I need to write my own
Quicktime movieplayer or XCMD?
I have looked in Inside Macintosh vol I - VI, but Quicktime is not
documented here.
Jostein :-D
------------------------------------------------------------------------------
The trouble with being poor is that it takes up all your time.
==============================================================================
| Jostein Svendsen | PO Box 587 |
| <josteisv@sofus.dhhalden.no> | N-1754 HALDEN |
| CS-Student, Ostfold Regional College | NORWAY |
==============================================================================
Path: ucivax!gateway
From: dnebing@andy.bgsu.edu
Subject: Dialog Problems
Message-ID: <9212100931.AA20947@andy.bgsu.edu>
Newsgroups: fa.think-c
Lines: 288
Date: 10 Dec 92 09:32:26 GMT
X-Attachments: :Hard Disk:11501:main.c: :Hard Disk:11501:a. .r:
In the code that follows, I am implementing a modal dialog
that contains a scroll bar and 12 strings. The scroll bar is
included so that I can display more than 12 strings overall.
That is how the code should work, but it doesn't. I get an
illegal instruction notice when I run it in the debugger
before I have a chance to do anything to the dialog.
If someone can show me the error in my ways, please feel free
to do so.
Dave Nebinger
P.S. Yes, I know the code is not pretty, but this is how it
got thrown together. Thanks in advance...
/*
Procedure: Signature
Purpose: To print the signature file for David Nebinger
*/
void Signature(void){
printf("%s\n%s %s\n%s\n%s\n",
"Dave Nebinger",
"dnebing@andy.bgsu.edu",
"dnebing@opie.bgsu.edu",
"Just because something is said to lighten a subject,",
"doesn't mean the subject is taken lightly.");
}
#define ContMin 1
#define ContMax 4
#define ArraySize 15
DialogPtr dialog;
Rect scr,ir;
ControlHandle scroll,ih;
int it,hit;
Str255 strs[ArraySize];
static pascal Boolean filter(DialogPtr dlg,EventRecord* evt,int* item);
static pascal void ScrollProc (ControlHandle theControl, int theCode);
static pascal void boxer(WindowPtr w,int item);
static pascal void defaultbox(WindowPtr w,int item);
main(){
int i;
InitGraf(&thePort);
InitFonts();
InitWindows();
InitMenus();
TEInit();
InitDialogs(0L);
InitCursor();
dialog=GetNewDialog(128,0L,(WindowPtr)-1L);
dialog->txFont=geneva;
dialog->txSize=12;
GetDItem(dialog,2,&it,&ih,&scr);
scroll= NewControl((WindowPtr)dialog, &scr, "\p", 1,ContMin,
ContMin,ContMax,scrollBarProc|useWFont, 0L);
SetDItem(dialog,2,it,scroll,&scr);
for (i=1;i<ArraySize+1;i++)
GetIndString(strs[i],128,i);
Sets(1);
GetDItem(dialog,15,&it,&ih,&ir);
SetDItem(dialog,15,it,defaultbox,&ir);
GetDItem(dialog,16,&it,&ih,&ir);
SetDItem(dialog,16,it,boxer,&ir);
do{
ModalDialog(filter,&hit);
switch(hit){
case 2:
break;
}
} while (hit!=1);
}
static pascal Boolean filter(DialogPtr dlg,EventRecord *evt,int *item){
int res;
if ((evt->what!=keyDown)&&(evt->what!=mouseDown))
return false;
res=0;
if (evt->what==keyDown){
switch((evt->message)&charCodeMask){
case 0x0d: // possible keypresses for return key
case 0x03:
*item=1;
res=1;
break;
}
} else
res=DoContent((WindowPtr)dlg,evt);
if (res)
return true;
else
return false;
}
static pascal void ScrollProc (ControlHandle theControl, int theCode){
int pageSize;
int scrollAmt;
int oldCtl;
if (theCode == 0)
return ;
pageSize = ContMax-ContMin;
switch (theCode) {
case inUpButton:
scrollAmt = -1;
break;
case inDownButton:
scrollAmt = 1;
break;
case inPageUp:
scrollAmt = -pageSize;
break;
case inPageDown:
scrollAmt = pageSize;
break;
}
oldCtl = GetCtlValue(theControl);
SetCtlValue(theControl, oldCtl+scrollAmt);
Sets(oldCtl+scrollAmt);
}
int Sets(int first){
int i;
int j;
Handle h;
Rect r;
for (i=1;i<13;i++){
GetDItem(dialog,2+i,&j,&h,&r);
SetIText(h,strs[first+i-1]);
}
}
int DoContent(WindowPtr theWindow, EventRecord *theEvent){
int cntlCode;
ControlHandle theControl;
int pageSize;
GrafPtr savePort;
int val;
GetPort(&savePort);
SetPort(theWindow);
GlobalToLocal(&theEvent->where);
if ((cntlCode = FindControl(theEvent->where, theWindow, &theControl)) !=
0) {
if (cntlCode == inThumb) {
TrackControl(theControl, theEvent->where, 0L);
val=GetCtlValue(theControl);
Sets(val);
} else
TrackControl(theControl, theEvent->where, &ScrollProc);
}
SetPort(savePort);
return cntlCode;
}
static pascal void boxer(WindowPtr dlg,int item){
Rect ir;
Handle ih;
int it;
GetDItem(dlg,16,&it,&ih,&ir);
PenSize(1,1);
FrameRect(&ir);
}
static pascal void defaultbox(WindowPtr dlg,int item){
Rect ir;
Handle ih;
int it;
GetDItem(dlg,1,&it,&ih,&ir);
PenSize(3,3);
InsetRect(&ir,-4,-4);
FrameRoundRect(&ir,16,16);
}
data 'DLOG' (128) {
$"004B 0026 0132 01CB 0002 0100 0000 0000" /* .K.&.2. ........
*/
$"0000 0080 00" /* ...A. */
};
data 'DITL' (128) {
$"0010 0000 0000 005F 0157 0073 0191 0402" /* ......._.W.s.e..
*/
$"4F4B 0000 0000 0006 0131 00C3 0140 0000" /* OK.......1. .@..
*/
$"0000 0000 000A 0013 001A 012D 080B 5374" /* ...........-..St
*/
$"6174 6963 2054 6578 7400 0000 0000 0019" /* atic Text.......
*/
$"0013 0029 012D 080B 5374 6174 6963 2054" /* ...).-..Static T
*/
$"6578 7400 0000 0000 0028 0013 0038 012D" /* ext......(...8.-
*/
$"080B 5374 6174 6963 2054 6578 7400 0000" /* ..Static Text...
*/
$"0000 0037 0013 0047 012D 080B 5374 6174" /* ...7...G.-..Stat
*/
$"6963 2054 6578 7400 0000 0000 0046 0013" /* ic Text......F..
*/
$"0056 012D 080B 5374 6174 6963 2054 6578" /* .V.-..Static Tex
*/
$"7400 0000 0000 0055 0013 0065 012D 080B" /* t......U...e.-..
*/
$"5374 6174 6963 2054 6578 7400 0000 0000" /* Static Text.....
*/
$"0064 0013 0074 012D 080B 5374 6174 6963" /* .d...t.-..Static
*/
$"2054 6578 7400 0000 0000 0073 0013 0083" /* Text......s...E
*/
$"012D 080B 5374 6174 6963 2054 6578 7400" /* .-..Static Text.
*/
$"0000 0000 0082 0013 0092 012D 080B 5374" /* .....C...i.-..St
*/
$"6174 6963 2054 6578 7400 0000 0000 0091" /* atic Text......e
*/
$"0013 00A1 012D 080B 5374 6174 6963 2054" /* ... .-..Static T
*/
$"6578 7400 0000 0000 00A0 0013 00B0 012D" /* ext...... ... .-
*/
$"080B 5374 6174 6963 2054 6578 7400 0000" /* ..Static Text...
*/
$"0000 00AF 0013 00BF 012D 080B 5374 6174" /* ... ... .-..Stat
*/
$"6963 2054 6578 7400 0000 0000 005B 0153" /* ic Text......[.S
*/
$"0077 0194 0000 0000 0000 0006 000E 00C3" /* .w.i...........
*/
$"0131 0000 0000 0000 00CC 0013 00DC 0140" /* .1....... .....@
*/
$"880B 5374 6174 6963 2054 6578 7400" /* a.Static Text. */
};
data 'STR#' (128) {
$"000F 0573 7472 2031 0573 7472 2032 0573" /* ...str 1.str 2.s
*/
$"7472 2033 0573 7472 2034 0573 7472 2035" /* tr 3.str 4.str 5
*/
$"0573 7472 2036 0573 7472 2037 0573 7472" /* .str 6.str 7.str
*/
$"2038 0573 7472 2039 0673 7472 2031 3006" /* 8.str 9.str 10.
*/
$"7374 7220 3131 0673 7472 2031 3206 7374" /* str 11.str 12.st
*/
$"7220 3133 0673 7472 2031 3406 7374 7220" /* r 13.str 14.str
*/
$"3135" /* 15 */
};
Path: ucivax!gateway
From: jimlynch@netcom.com (Jim Lynch)
Subject: GNU C++
Message-ID: <9212101535.AA19046@netcom2.netcom.com>
Newsgroups: fa.think-c
Lines: 35
Date: 10 Dec 92 15:35:55 GMT
In mailing list TCL-TALK@BROWNVM.brown.edu, "David J. Harr" <wirehead@CHESHIRE.OXY.EDU> said:
>>>>>
A group of people at Apple are working on implementing a
version of GCC 2.x that runs under MPW and compiles Mac
code. Eventually, it is planned to include g++ in the
distribution, but that is a ways down the road. For more
information, and the current status of the project,
contact Stan Shebs in Apple ATG, shebs@taurus.apple.com.
<<<<<
Thanks David... I have read Apple's "Experiences [so far - JL] of porting GCC
to the Mac" (or some such), which Stan may have written -- they were doing
some strange stuff to the compiler to get it to produce the right code for MPW
assembler, things like modifying the compiler (instead of the machine
description) to make it produce the variable declarations before the code.
I have some other ideas, such as doing a more direct port and using GAS (GNU
assembler) and changing the m68k machine description so it produces 16-bit
PC-relative code and using either A5 or A4 as an index register for references
to data.
Another idea I have is to make a simple app which would use the Communications
Toolbox and a terminal emulator and reserve perhaps 4-8 megs of RAM for a UNIX
or GNU program space and be able to use the Communications Toolbox as a UNIX
pipe or stream in order to talk to some VT-100 terminal emulator. That way,
I can have my Mac and GNU it too.
The reason I raise this here and the reason it's relavent (sp?) is that it
would be nice to have a high-quality C++ around for when Bedrock shows up,
should it not be prohibitively expensive and should it have _compilable_
source.
Has anyone done a more direct port?
-Jim
Path: ucivax!gateway
From: russne@catseq.catlin.edu (Russ Nelson)
Subject: ShutDownInstall()
Message-ID: <Pine.2.27-experimental.9212100859.A26357@catseq.catlin.edu>
Content-Type: TEXT/PLAIN; charset=US-ASCII
Mime-Version: 1.0
Newsgroups: fa.think-c
Lines: 24
Date: 10 Dec 92 16:35:48 GMT
Could someone either point me to helpful documentation on the ShutDown
Manager and how to use it (other than Inside Mac), or explain how? I am
trying to make an application that, when run, installs a procedure in the
shutdown queue. So far, I have compiled the procedure and have it stored
in a resource in my application. When I want to install it, I load it into
a Handle using GetResource(blah), MoveHHi(blah), HLock(blah), and feed it
to ShutDownInstall().
The procedure needs to find the default preferences folder, open the
resource fork of it's pref file, and dump a piece of memory to the file.
Nothing too complex. I had it running as an app before I compiled it to a
resource, and it worked fine.=
My computer ends up with a Bad F-Line Instruction (I think, I'm not at
it right now) when I try to shut down. I remembered to make sure the
procedure was declared as a pascal procedure. I'm not sure if it's the
procedure at fault, or if it's the way I am trying to install it.
Thanks in advance,
Russ
Russ Nelson * internet: russne@catseq.catlin.edu * bitnet: nelson@catlin
->This came directly from a computer and is not to be doubted or disbelieved.<-
Path: ucivax!gateway
From: franklin@eecs.ucdavis.edu (Paul Franklin)
Subject: Re: GNU C++
Message-ID: <9212101926.AA17420@endive.eecs.ucdavis.edu>
In-Reply-To: Your message of "10 Dec 92 15:35:55 PST."
<9212101535.AA19046@netcom2.netcom.com>
Newsgroups: fa.think-c
Reply-To: franklin@ece.ucdavis.edu
Lines: 30
Date: 10 Dec 92 19:26:32 GMT
Your message dated: 10 Dec 92 15:35:55 PST
>
>The reason I raise this here and the reason it's relavent (sp?) is that it
>would be nice to have a high-quality C++ around for when Bedrock shows up,
>should it not be prohibitively expensive and should it have _compilable_
>source.
>
>Has anyone done a more direct port?
Read TidBITS #149 for more information about TopSoft; they are
currently attempting a port. Here's the part mentioning GCC v. 2.
TopSoft is also working on another ambitious project at this time.
TopSoft C is a fully-featured C/C++ compiler, based on Eric Sink's
freeware Harvest C along with Stan Shebbs's and Brent Pease's port
of the Free Software Foundation's GCC version 2.
That's about all I know. The rest of the TidBITS article says a bit
about what TopSoft is (a nonprofit entity), as well as their
almost-released product FitlerTop, which is being released with C
source code that users can supposedly recompile with Think C 5.0 or
MPW C++.
I'd be glad to mail anyone a copy of the article in TidBITS #149, if I
see a lot of interest, I'll post the entire article. (However, maybe
there's someone here on the list who knows a bit more about TopSoft
who'd do a better job of saying what it is.)
--Paul Franklin
Path: ucivax!gateway
From: toontown!uogs@sequent.com (Omer Samman)
Subject: Unix mmap/munmap
Message-ID: <9212102005.AA25242@toontown.oceor>
Newsgroups: fa.think-c
Lines: 14
Date: 10 Dec 92 20:07:29 GMT
Hi,
I am porting a unix program which makes use of the OS functions mmap() and
munmap() to the Mac. The program heavily uses these functions to do internal
memory management (i.e., the memory is taken from one user and given to
another as the programs is running).
I need to implement simillar functionality. Is it possible? and How can it be
done?
Thanks in advance for any kind of help
Omer
Path: ucivax!gateway
From: swenson%john.Berkeley.EDU@ucbvax.berkeley.edu (Kirk Swenson)
Subject: Re: ShutDownInstall()
Message-ID: <9212102206.AA02401@john.berkeley.edu>
Newsgroups: fa.think-c
Lines: 20
Date: 10 Dec 92 22:14:08 GMT
Russ Nelson writes:
> Could someone either point me to helpful documentation on the ShutDown
>Manager and how to use it (other than Inside Mac), or explain how? I am
>trying to make an application that, when run, installs a procedure in the
>shutdown queue. So far, I have compiled the procedure and have it stored
>in a resource in my application. When I want to install it, I load it into
>a Handle using GetResource(blah), MoveHHi(blah), HLock(blah), and feed it
>to ShutDownInstall().
Applications quit before the ShutDown Manager takes over, so the shutdown
procedure must be loaded into the system heap. It sounds like you're
loading it into your application's heap, which doesn't exist when the
shutdown procedure runs. Also, you must call DetachResource so that the
resource isn't disposed when your application quits. Hope this helps.
Kirk Swenson
UC Berkeley
swenson@john.berkeley.edu
Path: ucivax!gateway
From: LAFARCIOLA@ichcmns.cmns.mnegri.it (max)
Subject: (none)
Message-ID: <B0FB1F9DB4FF200E2E@ichcmns.cmns.mnegri.it>
Content-transfer-encoding: 7BIT
Newsgroups: fa.think-c
X-VMS-To: in%"think-c@ics.uci.edu"
Lines: 8
Date: 11 Dec 92 16:51:02 GMT
Could someone either point me to helpful documentation (sources,books,etc...)
on the Client-Server applications and how to implement them for Macintosh-Vax
platform ?
Thanks in advance,
Massimo La Farciola
E-Mail:lafarciola@ichcmns.cmns.mnegri.it
Path: ucivax!gateway
From: k044477@hobbes.kzoo.edu ("Jamie R. McCarthy")
Subject: Profiling--what gotchas are there?
Message-ID: <9212111840.AA21679@hobbes.kzoo.edu>
X-Mailer: ELM [version 2.3 PL11]
Newsgroups: fa.think-c
Lines: 19
Date: 11 Dec 92 18:38:12 GMT
First of all, applause to the Think C team for including the easy,
powerful profiling tool that they did. It only took about three hours
of reading and coding before I started getting complete, precise
profiles of exactly the section of code that I wanted. I like that.
I've figured out (after trial and many errors) that I don't want to
gathering profile information about interrupt-level functions. I'm not
really sure why, because there's no memory moving going on, but I'll
take this on faith. (If I'm not mistaken, it's even dangerous to have
profiling turned on for interrupt-time function when _profile is 0.
Looking at the code, this baffles me--but it's hard to argue with a
system crash.)
Is there anything else I should know about profiling? Anything at all?
--
Jamie McCarthy Internet: k044477@kzoo.edu AppleLink: j.mccarthy
"As you should know by now, we're strong believers in the Apple II
and always will be. But we can't ignore reality forever."
- Tom Weishaar
Path: ucivax!gateway
From: russne@catseq.catlin.edu (Russ Nelson)
Subject: More ShutDown questions
Message-ID: <Pine.2.27-experimental.9212111222.A18030@catseq.catlin.edu>
Content-Type: TEXT/PLAIN; charset=US-ASCII
Mime-Version: 1.0
Newsgroups: fa.think-c
Lines: 20
Date: 11 Dec 92 20:30:43 GMT
Well, I seem to have solved the problem of my procedure crashing my Mac.
The problem was that I forgot to call DetachResource(theProc). Now, I have
a new problem. The procedure, when compiled as a seperate application,
builds the resource in its prefs file just fine, but when run as a code
resource from another application (or in this case, the shutdown manager),
the resource fork of its prefs file is somehow scrambled. When opening the
file, ResEdit says there were minor probs with the file that have now been
corrected, and the resultant file is empty. If anyone knows what might be
causing this, please let me know. If it doesn't ring a bell, I could post
the source; it's only about 2 pages.
Thanks again
Russ
P.S. Thanks to everyone who responded to my last problem.
Russ Nelson * internet: russne@catseq.catlin.edu * bitnet: nelson@catlin
->This came directly from a computer and is not to be doubted or disbelieved.<-
Path: ucivax!gateway
From: pchang@cs.stanford.edu (The Weasel)
Subject: Re: GNU C++
Message-ID: <9212102138.AA04103@Xenon.Stanford.EDU>
In-Reply-To: <9212101926.AA17420@endive.eecs.ucdavis.edu>; from "Paul Franklin" at Dec 10, 92 7:26 pm
X-Mailer: ELM [version 2.3 PL11]
Newsgroups: fa.think-c
Lines: 23
Date: 11 Dec 92 21:33:37 GMT
I sure that someone else from TopSoft could do a better job than me, but
since I am sort of working on porting Mr. Shebbs' MPW gcc port to a
standalone I guess I can say something of value.
TopSoft was created by a group of internetters who wanted to learn
some more about the mac, and have fun while doing it. After a bit of
thought we settled on the FilterTop project. There are a few other
projects floating about, but that is the biggie right now.
Some of us are working with Er-c Sink's Harvest C compiler to try
to extend it so that it is robust, and that it includes the gcc
stuff that stan is working on.
Well, I guess I don't have that much to say afterall. If someone out
there, Steve?? are you there, wants to add something I think that
that would be good.
Peter
--
Peter Chang | "To absent friends, lost loves, old gods,
E-Mail: pchang@cs.stanford.edu | and the season of the mists; and may
Snail Mail: PO Box 9603 | each and every one of us give the devil
Stanford, CA 94309 | his due" - Hob Gadling - Sandman
Path: ucivax!gateway
From: iom@dsunx1.dsrd.ornl.gov (MIKOLIC-TORREI I)
Subject: Finding a remote app using PPCToolbox (Q)
Message-ID: <9212121857.AA24678@dsunx1.DSRD.ORNL.GOV>
Newsgroups: fa.think-c
Lines: 161
Date: 12 Dec 92 18:58:07 GMT
Hello,
A couple of questions related to finding an app on a remote machine
over AppleTalk.
I want to send a high-level event to an app running on another Mac.
Page 5-23 of IM-6 says that to find that app, you use the IPCListPorts()
function (I don't want to use PPCBrowser()--my program needs to find the
other app all by itself).
Page 7-22 of IM-6 describes IPCListPorts() and says that I first need to
use GetZoneList() or GetLocalZones() to build a zone list, then PLookupName()
to obtain a list of computers in those zones, and finally IPCListPorts() to
find the ports (a.k.a. applications) on those computers.
Problem 1:
GetZoneList(), GetLocalZones(), and even GetMyZone() always return error
noBridgeErr "No router is available". What does this mean? Does this mean
that I only have my local, default zone (which is true: my home network
consists of a Mac IIci and a Mac+, that's it)? Or do I need to initialize
something somehow?
Problem 2:
By using the default zone wildcard character, I can successfully use
PLookupName() and IPCListPorts() to find my app on the other machine
__if I specify the app by name__.
However, if I try to specify my app by creator and type (which is what I
really *want* to do), IPCListPorts() fails to find anything.
The code follows. Sorry if this is some trivial mistake, but I've never
dealt with AppleTalk and the PPCToolbox before (except as a user of Sys7
file sharing ;)
Thanks in advance
Igor Mikolic-Torreira
igormt@alumni.caltech.edu
****Code follows*****
void DoTest( WindowPtr wp )
{
XPPParamBlock myXPPPB;
MPPParamBlock myMPPPB;
LocationNameRec theLocationNameRec;
PortInfoRec thePortInfoRec;
IPCListPortsPBRec theIPCListPortsPBRec;
PortInfoRec thePortInfoArray[30];
EntityName theEntity;
AddrBlock theAddrBlock;
char myEntityName[100];
char zoneList[578];
char myZoneName[33];
char returnList[5000];
OSErr myErr = noErr;
short xppRefnum, i;
SetPort( wp );
EraseRect( &wp->portRect );
MoveTo( 10, 20 );
DrawString( "\pTesting finding the other Time Sync App..." );
/* FIRST TRY TO FIND THE ZONE(S) */
/* Set up Parameter block for GetLocalZones() */
myXPPPB.XCALL.xppTimeout = 3;
myXPPPB.XCALL.xppRetry = 4;
myXPPPB.XCALL.zipLastFlag = 0;
myXPPPB.XCALL.zipInfoField[0] = myXPPPB.XCALL.zipInfoField[1] = 0;
myXPPPB.XCALL.zipBuffPtr = zoneList;
while ( myXPPPB.XCALL.zipLastFlag == 0 && myErr == noErr )
{
myErr = GetLocalZones( &myXPPPB, FALSE ); /* returns noBridgeErr */
Debugger();
}
/* Set up Parameter block for GetMyZone() */
myXPPPB.XCALL.xppTimeout = 3;
myXPPPB.XCALL.xppRetry = 4;
myXPPPB.XCALL.zipInfoField[0] = myXPPPB.XCALL.zipInfoField[1] = 0;
myXPPPB.XCALL.zipBuffPtr = myZoneName;
myErr = GetMyZone( &myXPPPB, FALSE ); /* returns noBridgeErr */
Debugger();
/* NEXT TRY TO FIND COMPUTERS IN A ZONE, AND MY APPL ON THAT MACHINE */
/* Set up Parameter block for PLookupName() */
NBPSetEntity( myEntityName, (Ptr) "\p=", (Ptr) "\pPPCToolBox", (Ptr) "\p*"
);
myMPPPB.NBP.interval = 8;
myMPPPB.NBP.count = 4;
myMPPPB.NBP.NBPPtrs.entityPtr = myEntityName;;
myMPPPB.NBP.parm.Lookup.retBuffPtr = returnList;
myMPPPB.NBP.parm.Lookup.retBuffSize = 500;
myMPPPB.NBP.parm.Lookup.maxToGet = 10;
myErr = PLookupName( &myMPPPB, FALSE );
Debugger();
/* Set up Parameter block for IPCListPorts() */
theLocationNameRec.locationKindSelector = ppcNBPLocation;
thePortInfoRec.name.nameScript = 0;
#ifdef BY_NAME
/* This works just fine !!! */
strcpy( (char *) thePortInfoRec.name.name, "Time Sync Test" );
CtoPstr( (char *) thePortInfoRec.name.name );
thePortInfoRec.name.portKindSelector = ppcByString;
strcpy( (char *) thePortInfoRec.name.u.portTypeStr, "=" );
CtoPstr( (char *) thePortInfoRec.name.u.portTypeStr );
#else
/* This fails: IPCListPorts to return .actualCount = 0 */
strcpy( (char *) thePortInfoRec.name.name, "=" );
CtoPstr( (char *) thePortInfoRec.name.name );
thePortInfoRec.name.portKindSelector = ppcByCreatorAndType;
thePortInfoRec.name.u.port.creator = 'IMTt';
thePortInfoRec.name.u.port.type = 'APPL';
#endif
theIPCListPortsPBRec.startIndex = 0;
theIPCListPortsPBRec.requestCount = 10;
theIPCListPortsPBRec.portName = &(thePortInfoRec.name);
theIPCListPortsPBRec.locationName = &theLocationNameRec;
theIPCListPortsPBRec.bufferPtr = thePortInfoArray;
for ( i = 1; i <= myMPPPB.NBP.parm.Lookup.numGotten; i++)
{
/* Get a list of computers (=locations) */
myErr = NBPExtract( returnList, myMPPPB.NBP.parm.Lookup.numGotten, i,
&theEntity, &theAddrBlock );
theLocationNameRec.u.nbpEntity = theEntity;
/* See if my app (=port) is there */
myErr = IPCListPorts( &theIPCListPortsPBRec, FALSE );
Debugger();
}
}
Path: ucivax!gateway
From: nagel@kithrup.irvine.ca.us ("Mark D. Nagel")
Subject: ARCHIVE: Word Services SDK
Message-ID: <0E010598.kvogms@kithrup.Irvine.CA.US>
X-Mailer: uAccess - Macintosh Release: 1.6v1
Newsgroups: fa.think-c
Reply-To: think-c-request@ics.uci.edu
Lines: 339
Date: 13 Dec 92 03:07:45 GMT
[Please send mail to D1620@applelink.apple.com if you have any
questions about this product. -- MDN]
Michael D. Crawford
Working Software, Inc.
AppleLink D1620
Contents
Introduction
Helpful Hints
How it Works
The Services Menu
Initiating a Session
Changes to be Made in the Protocol and Demo Code
Introduction
This is a brief overview of the source code to the Writeswell Jr. program
that is used to demonstrate the word-processor side of the Word Services
Suite. Writeswell Jr. is a simple TextEdit based text editor. It is
Apple Event aware, though, and can call a spelling checker, grammar
checker, hyphenator, or other word services via the Word Services
protocol.
This sample code works but is not completed and does not completely match
the Word Services Suite specification. The spec has grown and changed
with time, and so has the sample code - but they dont always match. The
sample code is now in the 1.0 final release. We are still awaiting the
final draft of the protocol specification from Apple. Where there are
differences betwwen the spec and the sample code, follow the sample code
and this document. When the final release of the Word Services
specification appears, use the specification.
Helpful Hints
Here are hints based on the experience of the other developers that have
implemented the protocol in their own applications.
Writeswell Jr. can be run off of a CD since it creates a preference file
on your hard disk. IAC Spell Test will need to be on your hard disk since
it saves its dictionary location in its own resource file.
You must install a debugger such as Macsbug when running the Writeswell
Jr., and the IAC Spell Test speller. If there is an error, the
applications call the debugger with a helpful error message. If no
debugger is installed, you will get an Unimplemented A-Trap System
Error. If an error is returned from a trap call, the command D7.W will
usually display the result code in Macsbug, and the command g will
continue execution.
Also, be sure you have the SIZE resource correct. You will need the High
Level Event Aware and the Can Background bits set. There is some
possibility that you may need to change the logic of your program slightly
if you have never used background processing before.
How it Works
The program starts in main in TestBed.c. Main initialized the managers,
calls functions to install the various handlers, and starts up the event
loop.
There are two sets of Apple Event handlers. The first set, in
MyHandlers.c, handle the required Apple Events. These are the OAPP, ODOC,
PDOC, and QUIT handlers from the kCoreEventClass. The one notably useful
code is MyOAPPHandler, which can open a file from disk. You can open a
file at any time by dragging its icon onto Writeswell Jr.'s icon, as long
as Writeswell Jr. has no windows open (it can only handle a single
window). The handler calls MyOpenFile in MyFiles.c, which calls
MakeNewWindow to create a window (with a TextEdit handle stuffed into the
window's refCon), and then reads the text from the file into the TextEdit
field.
The Core suite events are handled by a single "wildcard" handler,
GenericHandler in GenHandlers.c, using an "inverted" method suggested to
me by Richard Clark of Developer University. GenericHandler extracts the
direct object from the event and calls AEResolve to identify the object
that is specified by the event, and then calls a dispatcher for the given
object type. This allows me to neatly separate all the code for each
object class into different files for easy maintenance. There aren't many
classes here yet, but I think this makes much more sense than having each
event handler handle the events for each class.
(One can be easily confused by the "kCoreEventClass" constant for the
required event class, and the "kAECoreSuite" constant for the Core Suite.)
The classes I support are cApplication, cWindow, cText, and
typeObjectSpecifier. You may get and set a windows title, and you may
count the cText and the typeObjectSpecifier elements of the window. Note
that I use a coercion handler to convert typeChar data into "typePString"
data in order to set the window title; this is a type that would be good
to have defined in the Core suite. The coercion handler is
TextPtrToPString in ObText.c. Note that the window code does not "know"
about TextPtrToPString; it just asks for the data type, and gets it
because the coercion handler is present.
I use a trick in my token data structures. A typical token body is as
follows:
typedef struct {
TEHandle textH;
short startPos; /* Short cuz TE only handles 32k o' text! */
short length;
DescType propertyCode;
} TETextTokenBody;
If my object accessors are given a key form of formPropertyID, the ID is
placed in propertyCode; if they are not, then the desired data is the
object itself (the window, the text, etc., rather than the title of the
window or the font of the text), and I used a propertyCode of 'null'.
Here I make the assumption that 'null' will never be a property; this may
not be a valid assumption. The trick is handy in my event handlers; I
just switch off the property code to determine what to do:
OSErr TETextSetDataHandler(... )...
switch ( propCode ){
case typeNull:
...
TEInsert( (Ptr)(*textValue.dataHandle), newTextLen, textH );
break;
case propBackgroundHilite:
TESetSelect( (*tokHdl)->startPos,
(*tokHdl)->startPos + (*tokHdl)->length,
textH );
TEActivate( textH );
break;
default:
return errAENoSuchObject;
break;
}
Though the Core Suite specifies a single cText class, the text in your
application may be of different types - editable text in windows,
non-editable text in menu titles or menu items and so on. You will need a
number of different token types for your text to reflect the different
kinds of text that you may have.
The key to supporting the Word Services suite is to support formRange and
end-of-container formAbsolutePosition key forms. Specifying a position
relative to the end of the container allows the text to be changed by
several successive Set Data events without having to do extra work to
calculate new offsets. One can tell that a formAbsolutePosition key is
relative to the end of the container because it will be negative; -1 is
the last object in the container. See the code in CharFromTEText in
ObText.c.
The Object Support Library documentation is unclear about how to resolve
formRange specifiers. Note that to specify a range of characters, we use
a formRange object specifier that consists of two formAbsolutePosition
specifiers, which specify a single character at the beginning and end of
the range. When an object accessor recieves a formRange key, the
selectionData is a descriptor of type 'rang'. You can coerce this to
typeAERecord, and then use AEGetKeyDesc to extract the keyAERangeStart and
keyAERangeStop object specifiers. If you don't coerce to typeAERecord,
the call to AEGetKeyDesc will fail - it does not recognize the the 'rang'
data type is really an AERecord. You must then call AEResolve on each of
the two specifiers to get the beginning and end of the range. Note that
this is a recursive call - your object accessor has already been called by
AEResolve; thus object accessors must be reentrant - they must not change
global variables.
Following is the formRange code from CharFromTEText:
case formRange:
err = AECoerceDesc( selectionData, typeAERecord, &rangeRecord );
if ( err ) return err;
err = AEGetKeyDesc( &rangeRecord, keyAERangeStart,
typeObjectSpecifier, &startSpec );
if ( err ) return err;
err = AEGetKeyDesc( &rangeRecord, keyAERangeStop,
typeObjectSpecifier, &endSpec );
if ( err ) return err;
err = AEResolve( &startSpec, kAEIDoMinimum, &startToken );
if ( err ) return err;
err = AEResolve( &endSpec, kAEIDoMinimum, &endToken );
if ( err ) return err;
(... now make the token from the beginning and end tokens...)
The Services Menu
Word Services provides for a simple way to register new services with
applications. Launch the speller (IAC Spell Test in this case). Launch
Writeswell Jr. and select New Batch Service from the Services menu.
Select IAC Spell Test from the PPCBrowser display.
Writeswell Jr. sends a Get Data event to request the pBatchMenuString
property from IAC Spell Test, and another Get Data to request the
pLocation property. The menu string is saved in the Writeswell Jr.
Preferences file, and added to the Services menu. The pLocation is an
alias record. IAC Spell Test places its creator code in the userType
field of the alias. This is important - the alias manager puts 0 in the
userType - the value placed there is up to the application; the Word
Services spec requires the actual signature of the speller, so that it is
easily accessible to the word processor.
The preferences file also contains a record that records the type of
service for each menu item - either batch service, interactive service, or
no service. (Interactive service is not yet implemented). When the menu
is built, a global array, gServItemID, stores the resource ID for each
service menu item. When the service is selected from the menu,
OpenSpeller in DoChecking.c looks up the resource ID in gServItemID. The
alias record is read in. OpenSpeller calls FindAProcess to see if a
process is running with that creator code. If it is not, then OpenSpeller
calls LaunchSpeller to launch the speller application from the alias, and
then returns a typeApplSignature descriptor for use in the AESend call to
send the batch event.
You can simulate the presence of multiple Word Service programs on your
hard disk. Make several copies of the IAC Spell Test. Use ResEdit to
give each copy a unique creator code. Change the STR# 1300 resource to
give each one a unique menu string. Then launch each one, and install it
in Writeswell Jr.s menu (or your own applications menu!) Each copy of
the speller will need its own dictionary if they are to run all at the
same time.
The code that services the Get Data event for the pLocation property of
IAC Spell Test actually checks to see what its own creator code is.
Normally, you just use a constant, but I wanted to allow for the simulated
multiple servers.
Initiating a session
You may start a Word Services session by selecting Check Spelling with
IAC Spell Test from the services menu, after installing the menu item as
described above.
Selecting a service results in a call to DoSpellCheck in DoChecking.c.
DoSpellCheck calls OpenSpeller to look for the server, launch it if
necessary, and obtain its address as a typeApplSignature descriptor.
Then DoSpellCheck calls either DoBatchCheck or DoBatchTableCheck to send a
Batch Process My Text Apple Event to the server. The batch event
contains a parameter that specifies what text is to be checked. The
speller uses this parameter in subsequent Get Data and Set Data events to
read and replace the text, and to set the background hilighting.
There are two ways that the text may be specified in the batch event. You
can choose which is used by selection Options from the Writeswell Jr.
Edit menu.
The Send text specifiers option makes Writeswell Jr. send the object
specifiers for the text explicitly. The direct object to the batch event
is a list (a descriptor of typeAEList) which contains a single element,
which is an object specifier for the first (and only) text field in the
frontmost window.
Client programs that allow more than one text block, such as drawing
programs, spreadsheets, and databases, may have several blocks checked at
once by sending an object specifier to each block in the list.
This is easy to do and works well if there are not too many text blocks to
be checked. It will not work if there are many text blocks, since an
Apple Event may not contain more than 64K of data.
The Send table specifier option sends an object specifier for a table
instead. The direct object is a descriptor of typeObjectSpecifier. The
server will use the table specifier as a container to ask for elements of
typeObjectSpecifier. That is, the server will ask for object specifier
number 27, which is contained within the first window of the
application. The object specifier that is gotten from the table is used
in just the same manner as the object specifiers that are contained in the
list from the Send text specifiers method.
A client application may choose to user either method. The method used
will be invisible to the user - I allow the option here for so programmers
may test either way. A server application must support both methods.
The server uses the descriptor type of the batch events direct object to
determine which method to use. If the direct object is typeAEList, then
the server expects the direct object to contain a list of object
specifiers. If the direct object is typeObjectSpecifier, then the server
expects that the direct object may be used access the elements of a table
that is kept within the client.
In the Writeswell Jr. code, the table is just the document window. The
elements of the window that are of typeObjectSpecifier are object
specifiers to the text fields in the window that are to be spellchecked.
(Theres only one text field, but there could be more in general). If one
uses Get Data to get the first text element in the window, the text will
be returned. If one uses Get Data to get the first object specifier
element in the window, then an object specifier will be returned. This
object specifier refers to the text element.
If you get this far, your head must be swimming. Go have a cup of tea and
relax for a while. You have read the words object specifier entirely
too many times.
It is up to you what you want to use for a container. I chose to use a
window, but you could use the application (or null) container, or you
could use some other object. The server does not examine the table
specifier itself; it just uses it as container to get an element from.
Changes to be Made in the Demo Code
There will be some changes in the Word Services Suite from what is done
here.
The menu strings will be elements of the application rather than
properties. There will be an optional parameter added to the batch event
to specify which service is desired. This will allow a single server
application to provide multiple services, each with their own menu string.
There are discussions under way on how to allow Word Services to support
servers that use modeless dialogs. This will mainly be of use to grammar
checkers, which will be able to tell the user to rephrase some text back
in the original document, and then continue where they left off when the
user selects the grammar checkers window. This will be an optional
capability, and will require the client to maintain some state information
during a Word Services session.
The other main change is the way that the background highlighting is done.
The current draft of the protocol says that the text which is highlit in
the background is specified to be elements of a table, so that it is
possible to show several ranges of highlit text.
The background hilighting is a property of a single character, as the font
and style are in the Text Suite. The application will have a Boolean
property to allow the server to determine if the client supports disjoint
ranges.
1992 Working Software, Inc.
This source code is copyrighted. Permission is granted to use the Word
Services portion of the Writeswell Jr. source code in your own programs,
but you may not distribute the Writeswell Jr. word-processor code as a
commercial product. If you modify the code, please do not call it
Writeswell Jr. (or Writeswell.) This will ensure that people understand
the program and dont have to deal with a number of different versions
with who-knows-what going on in the code.
Writeswell Jr. and Writeswell are trademarks of Working Software, Inc.
/*****************************************************************************/
[saved as: /mac/think-c/demos/ws-sdk-1.0.hqx; 504K]
Path: ucivax!gateway
From: yarri@icrl.mew.mei.co.jp (Douglas Yarrington)
Subject: Re: GNU C++
Message-ID: <9212140619.AA10890@solbol.icrl.mew.mei.co.jp>
In-Reply-To: <9212101926.AA17420@endive.eecs.ucdavis.edu>; from "Paul Franklin" at Dec 10, 92 7:26 pm
X-Mailer: ELM [version 2.3 PL11]
Newsgroups: fa.think-c
Lines: 71
Date: 14 Dec 92 06:33:56 GMT
Paul Franklin writes:
> >The reason I raise this here and the reason is that it
> >would be nice to have a high-quality C++ around...
> >Has anyone done a more direct port?
> Read TidBITS #149 for more information about TopSoft; they are
> currently attempting a port. Here's the part mentioning GCC v. 2.
> TopSoft is also working on another ambitious project at this time.
> TopSoft C is a fully-featured C/C++ compiler, based on Eric Sink's
> freeware Harvest C along with Stan Shebbs's and Brent Pease's port
> of the Free Software Foundation's GCC version 2.
> However, maybe there's someone here on the list who knows a bit
> more about TopSoft who'd do a better job of saying what it is.
Peter Chang writes back:
> TopSoft was created by a group of internetters who wanted to learn
> some more about the mac, and have fun while doing it. After a bit of
> thought we settled on the FilterTop project. There are a few other
> projects floating about, but that is the biggie right now.
>
> Some of us are working with Er-c Sink's Harvest C compiler to try
> to extend it so that it is robust, and that it includes the gcc
> stuff that stan is working on.
Well I'll add to this... I'm one of the founding members of TopSoft, and,
like the speil says, we're an organized group of internetters who all have
the goal of producing some useful Mac-specific software for public use in
the same spirit as Richard Stallman's Free Software Foundation.
We are working on a several projects, including a fully C++ compatible
compiler (TopSoftC) based on GCC. We plan to release our first product,
FilterTop, next month.
We have several mailing lists set up where you can get more information on
TopSoft, or on some of the specific projects. Please contact the
administrators of these lists for more info:
TopSoft: ts-info@syrinx.kgs.ukans.edu
(or try: pfterry@msmail.kgs.ukans.edu)
TopSoft C: tc-info@syrinx.kgs.ukans.edu
(or try: surak@ugcs.caltech.edu)
FilterTop: ft-info@syrinx.kgs.ukans.edu
(or try: stevej@ais.org)
You can also get some information on your own by contacting our ftp site at
syrinx.kgs.ukans.edu (login as anonymous), look under the ~/topsoft
directory for specific project information.
Or, you could always pummel me with more email :)
If any of you on this Think-C mailing list are interested in joining us,
let us know. We have all types of people in TopSoft, not just expert
programmers. And, best of all, we're all interested in helping each other
out. From my experience, it's been a great way to learn the nuances of Mac
programming.
Hope to hear from you later.
--douglas
Ho ho ho ho ho ho o<<(8o)}}>
Douglas Yarrington yarri@icrl.mew.mei.co.jp
IBS Systems - Digital Design Flat Antenna Stuff
Matsushita Electric Works, Ltd "A beautiful place to be for a while"
Path: ucivax!gateway
From: Per.Mildner@csd.uu.se (Per Mildner)
Subject: Re: Finding a remote app using PPCToolbox (Q)
X-Sender: perm@meryl.csd.uu.se
Message-ID: <199212140904.AA17522@meryl.csd.uu.se>
Newsgroups: fa.think-c
X-Charset: ASCII
Lines: 7
Date: 14 Dec 92 09:04:47 GMT
X-Char-Esc: 29
Try looking for the name "ep01SIGN" (or maybe "SIGNep01") where SIGN is the
app signature. This is undocumented but seem to be the only way.
Per Mildner Preferred: Per.Mildner@CSD.UU.SE
Computing Science Dept. AppleLink: sw1106
Uppsala University tel: +46 18 181049
Box 311, S-751 05 Uppsala,Sweden fax: +46 18 521270
Path: ucivax!gateway
From: TPZ4@vm.cnuce.cnr.it (Rodolfo Cardarelli)
Subject: Yet Another Compiler Question...
Message-ID: <9212140643.aa08385@q2.ics.uci.edu>
Newsgroups: fa.think-c
Lines: 26
Date: 14 Dec 92 14:43:16 GMT
I apologize for asking the same old questions, about Mac Primer...
I tried to run Reminder, which is one of the small programs in the book.
The compiler, in run time, gives me the "illegal instruction" message, when
I try to place an handle on the Apple Menu to add the DRVR resources (I feel
ashamed to ask this questions...)
Anyway the piece of code looks like
MenuHandle gAppleMenu
gMyBar=GetNewMBar(400) //I haven't got all the character on this keyboard...
gAppleMenu=GetMHandle(400) //so semicolons are missing
AddResId(gAppleMenu,'DRVR')
The funny thing is that if I change the instruction to
gAppleMenu=GetMenu(400)
then it works| So it seems that GetNewMBar isn't calling the appropriate
GetMenu routines. I checked the code with Timer, which has a similar
structure, and everything looks ok (it always does so...)
The resource file looks alright as well
Any suggestion? And by the way, which is the difference between GetMHandle and
GetMenu? I did'n understand it verey well. Another book suggests another techn
ique, that is using InsertMenu before DrawBar
Which is working better?
Thank you for any help
Rodolfo Cardarelli
TPZ4@ICNUCEVM.CNUCE.CNR.IT
Path: ucivax!gateway
From: asaria@rrdtc.donnelley.com
Subject: ResEdit & System 7.1
Message-ID: <9212141903.AA16991@uu.psi.com>
Newsgroups: fa.think-c
Lines: 15
Date: 14 Dec 92 19:31:21 GMT
I'm asking this for one of the other developers here so I may not have all
of the facts. He ran into trouble using ResEdit (v2.1.1) with System 7.1.
Specifically, ResEdit crashed when he tried to create a new resource and
locked up his Mac.
Has anybody else run into problems with ResEdit and System 7.1? Also is
version 2.1.1 of ResEdit the latest one?
Please e-mail, and I'll post a summary if there is sufficient interest.
Thanks,
Riyaz Asaria
asaria@donnelley.com
Path: ucivax!gateway
From: C2MXBAR@fre.towson.edu (Aaron Barnett)
Subject: tear-off menu/windoid code?
Message-ID: <01GSBICUDFQQ9S5V95@TOE.TOWSON.EDU>
Content-transfer-encoding: 7BIT
MIME-version: 1.0
Newsgroups: fa.think-c
X-VMS-To: TOE::IN%"think-c@ics.uci.edu"
Lines: 9
Date: 15 Dec 92 16:21:33 GMT
X-Envelope-to: think-c@ics.uci.edu
i found a snippit for this at apple called Windoid 1.0b2.2
looks like a great demo, does all i need to do, but its written in
a cpp/MacApp combo (greek to me) and all the base classes seem not to be
there...
can someone point me to some think c code on this subject?
thanks
aaron
Path: ucivax!gateway
From: ksand@apple.com
Subject: Re: tear-off menu/windoid code?
Message-ID: <9212151732.AA03635@apple.com>
Newsgroups: fa.think-c
Lines: 20
Date: 15 Dec 92 17:33:25 GMT
>i found a snippit for this at apple called Windoid 1.0b2.2
>looks like a great demo, does all i need to do, but its written in
>a cpp/MacApp combo (greek to me) and all the base classes seem not to be
>there...
>
> can someone point me to some think c code on this subject?
Well, it was my old MacApp 3.0b2 sample. Check out the Think class
library for another implementation of floating windows, also newer
releases of DTS Kibitz will have an implementation (that does not patch
all around the toolbox traps, instead it's careful about what Window
Manager traps it calls, and handles the window list itself).
Finally, the ultimate source to floating windows stuff is on one of the
MacTutor volumes (don't remember the exact location just now).
Kent
---
ksand@apple.com
Path: ucivax!gateway
From: FLC3527@tamxrd.tamu.edu (Trey Campbell)
Subject: RE: Yet Another Compiler Question...
Message-ID: <921214104818.20202ea3@TAMXRD.TAMU.EDU>
Newsgroups: fa.think-c
Lines: 39
Date: 16 Dec 92 06:54:22 GMT
X-Vmsmail-To: SMTP%"fa.think-c-outbound-request@ics.uci.edu"
Rodolfo Cardarelli writes:
>I apologize for asking the same old questions, about Mac Primer...
>I tried to run Reminder, which is one of the small programs in the book.
>The compiler, in run time, gives me the "illegal instruction" message, when
>I try to place an handle on the Apple Menu to add the DRVR resources (I feel
>ashamed to ask this questions...)
>Anyway the piece of code looks like
>MenuHandle gAppleMenu
>gMyBar=GetNewMBar(400) //I haven't got all the character on this keyboard...
>gAppleMenu=GetMHandle(400) //so semicolons are missing
>AddResId(gAppleMenu,'DRVR')
>The funny thing is that if I change the instruction to
>gAppleMenu=GetMenu(400)
>then it works| So it seems that GetNewMBar isn't calling the appropriate
>GetMenu routines. I checked the code with Timer, which has a similar
>structure, and everything looks ok (it always does so...)
>The resource file looks alright as well
>Any suggestion? And by the way, which is the difference between GetMHandle and
>GetMenu? I did'n understand it verey well. Another book suggests another techn
>ique, that is using InsertMenu before DrawBar
>Which is working better?
>Thank you for any help
If the 'MBAR' resource exists and is correctly defined, your "Apple" menu
should be loaded into memory by GetNewMBar(). My understanding is that
GetMHandle() returns a handle to a 'MENU' resource that is already in memory
and returns NULL if the resource can't be found. GetMenu() is like calling
GetResource() and specifying type 'MENU.' It appears from what you've said that
the call to GetNewMBar() isn't loading your 'MENU.' I would suggest that you
check very carefully your 'MBAR' and 'MENU' resources. Remember that when you
change the resource ID of a 'MENU' you not only have to change it in the
resource info, but also the Menu ID (check the under "MENU" in ResEdit).
I hope this helps,
Trey Campbell
X-Ray Diffraction Lab, Texas A&M University
Path: ucivax!gateway
From: mdl@junior.bintec.de (Mike Lyons)
Subject: Need driver for Toshiba TXM3301E1 CD-ROM
Message-ID: <9212161704.AA00363@junior.bintec.de>
Newsgroups: fa.think-c
Lines: 29
Date: 16 Dec 92 17:11:18 GMT
Hi all,
I realize that this is only indirectly related to this group, but
my Usenet posting software is broken and I'm beoming desparate.
The story:
I just got a mailing of developer CD-ROMS from APDA but my Apple
drive is kaputt. I snarfed the CD-ROM drive from our Silicon
Graphics Indigo. This is a Toshiba TXM3301E1, but the Toshiba
driver for the Mac that I found lying around only caused my
machine (Mac IIci 16 MB, System 7.0.1 tuned) to crash. Does an-
ybody use this drive and have an up to date driver and
support software for it? If so, could you binhex or uuencode
them and e-mail them to me?
Thanks in advance,
Mike
p.s. vi, nroff and elm...it almost works
--
================================================================================
| Michael D. Lyons | Telefon: +49 911 996750 | EMail: mdl@BinTec.DE |
| BinTec Computersysteme | Telefax: +49 911 6880725 | |
| Willstaetter Strasse 30 / D-8500 Nuernberg 60 / GERMANY |
================================================================================
Path: ucivax!gateway
From: kirk_crawford@qmail2.aero.org (Kirk Crawford)
Subject: Think C->Windows?
Message-ID: <199212162221.AA25820@aerospace.aero.org>
Posted-Date: 16 Dec 92 14:25:07 U
Newsgroups: fa.think-c
Lines: 8
Date: 16 Dec 92 22:21:59 GMT
Subject: Think C->Windows?
I heard of a program or service a while ago that will allow you to convert your
Think C source to some other C source code for Windows. Does this still exist?
Does anyone have the specifics on it?
-Kirk Crawford
Path: ucivax!gateway
From: evans@natural.com (Christopher Evans)
Subject: Mounting servers w/o users
Message-ID: <9212162105.AA17142@natural.com>
Newsgroups: fa.think-c
Lines: 17
Date: 16 Dec 92 22:57:10 GMT
What is hte best way to mount an appleshare server without any
user intervention? I need to be able to programmatically mount a
server when users aren't around. You can assume that I can get a password
and user account if necessary. I tried resolving aliases but it seems
to always bring up the login dialog box so that won't do. Any ideas?
<==================================Q======================================>
Chris Evans | Internet: evans@natural.com
Development | Phone: 617-876-4876
Natural Intelligence, Inc. | FAX: 617-492-7425
2067 Massachusetts Avenue | AppleLink: NATURAL
Cambridge MA 02140 | or evans@natural.com@INTERNET#
Heavy, adj.:
Seduced by the chocolate side of the force.
Path: ucivax!gateway
From: jpff@maths.bath.ac.uk
Subject: A Dumb question
Via: uk.ac.bath.maths; Thu, 17 Dec 1992 13:06:00 +0000
Message-ID: <9212170506.aa20524@q2.ics.uci.edu>
Newsgroups: fa.think-c
Lines: 13
Date: 17 Dec 92 13:06:28 GMT
I am rather new to the Mac, and I have tried toi read Inside Mac, but
it is not written in my language. I have an application which i would
like to be able o contiue to run in the background as well as
interactively. It can happily go away for the odd hour to compute
something, and it seems a shame to hang the machine for all that time.
A present the rogram enters a routine on a clock interrupt to check
for Command-. as an interrupt. What do I have to add? I am using teh
command pckage in Think_C, and no graphics.
Any suggestions, or sample code in C would be appriciated.
==John ff
Path: ucivax!gateway
From: kirk_crawford@qmail2.aero.org (Kirk Crawford)
Subject: Y Modem Source wanted
Message-ID: <199212171658.AA02716@aerospace.aero.org>
Posted-Date: 17 Dec 92 09:04:05 U
Newsgroups: fa.think-c
Lines: 6
Date: 17 Dec 92 16:59:07 GMT
Subject: Y Modem Source wanted
Anyone have any C source code for Y Modem? PD would be preffered.
-Kirk
Path: ucivax!gateway
From: umdenbo0@ccu.umanitoba.ca ("David A. Denboer")
Subject: Problems with THINK C
Message-ID: <9212172228.AA07221@ccu.UManitoba.CA>
X-Mailer: ELM [version 2.3 PL11]
Newsgroups: fa.think-c
Lines: 17
Date: 17 Dec 92 22:28:22 GMT
This is the second time I have had this type of problem with THINK C > 5.03
When declaring variables :
extern short numMovies;
The compiler stops and says "Invalid Declaration"
The declaration is right after :
#include "MyApp.h"
For some strange reason, this is an intermittent problem. It worked
this morning, and by about noon, it died.
Any help would be appreciated.
--
David A. denBoer * Musi Computer Products
umdenbo0@next01.cc.umanitoba.ca (NeXT Mail welcome) * 9 Abington Rd
Manitoba Macintosh Developers Assn * Winnipeg, MB
mac-develop-request@ccu.umanitoba.ca * Canada, R2J 3S7
Path: ucivax!gateway
From: asaria@rrdtc.donnelley.com
Subject: FSSpec for the running application
Message-ID: <9212181939.AA18089@uu.psi.com>
Newsgroups: fa.think-c
Lines: 17
Date: 18 Dec 92 19:46:46 GMT
Hello,
I'm trying to open up a file in the same folder as my application. What's
the best way to do this?
I thought that if I could get an FSSpec for my application, then I could
use the volume and directory information to construct an FSSpec for the
file I want to open. This seemed pretty straightforward until I tried
to find out how to get the FSSpec. I've checked the New-IM/Files, but
didn't see how to do this.
I'd appreciate any help on this.
Thanks.
Riyaz
Path: ucivax!gateway
From: dnebing@andy.bgsu.edu
Subject: Re: Y Modem Source wanted
Message-ID: <9212182018.AA07687@andy.bgsu.edu>
Newsgroups: fa.think-c
Lines: 25
Date: 18 Dec 92 20:19:19 GMT
>Subject: Y Modem Source wanted
>Anyone have any C source code for Y Modem? PD would be preffered.
>-Kirk
It's in the distribution to the x modem protocal. The package
includes x modem, x-y modem, batch, etc. protocols. I wouldn't know
where to look off hand, but you could probably find it using archie...
Dave Nebinger
/*
Procedure: Signature
Purpose: To print the signature file for David Nebinger
*/
void Signature(void){
printf("%s\n%s %s\n%s\n%s\n",
"Dave Nebinger",
"dnebing@andy.bgsu.edu",
"dnebing@opie.bgsu.edu",
"Just because something is said to lighten a subject,",
"doesn't mean the subject is taken lightly.");
}
Path: ucivax!gateway
From: evans@natural.com (Christopher Evans)
Subject: hooking in to existing apps
Message-ID: <9212190154.AA00548@natural.com>
Newsgroups: fa.think-c
Lines: 21
Date: 19 Dec 92 03:04:30 GMT
Can anyone point me to some sample code for hooking in to existing
applications and either adding controls to window bars, adding menus to
menu bars and / or capturing keystrokes before they are passed to the
application? I want to be able to add features to an text application
that don't currently exist.
Any help will be appreciated.
<==================================Q======================================>
Chris Evans | Internet: evans@natural.com
Development | Phone: 617-876-4876
Natural Intelligence, Inc. | FAX: 617-492-7425
2067 Massachusetts Avenue | AppleLink: NATURAL
Cambridge MA 02140 | or evans@natural.com@INTERNET#
Dawn, n.:
The time when men of reason go to bed.
-- Ambrose Bierce, "The Devil's Dictionary"
Path: ucivax!gateway
From: jgarner@seattleu.edu (Jeff Garner)
Subject: Re: FSSpec for the running application
Message-ID: <Pine.3.03.9212182212.A16323-c100000@sumax.seattleu.edu>
In-Reply-To: <9212181939.AA18089@uu.psi.com>
Content-Type: TEXT/PLAIN; charset=US-ASCII
Mime-Version: 1.0
Newsgroups: fa.think-c
Lines: 79
Date: 19 Dec 92 06:39:50 GMT
This was already answered in an earlier post... and I was glad I had
captured it, cause I had to do the exact same thing in one of my projects
yesterday! Here's what I had captured:
SCHENKL@vax.cs.hscsyr.edu wrote:
>I'm writing an INIT, that every hour will read a resource from it's file, but
>for the life of me I don't know how to find out how to re-open it! I'm
looking
>for a System 6.x compatable command that will tell me the name and vRef, or
>I guess a FSSpec will do, of my INIT file at startup time. I know there
is a
>way do to it, and I think that at one time I had some code to do it, but I
>can't seem to find it here. (I have the develope CD Rom (vX) here, so if
it's
>on it just tell me a name...)
Just call the following routine with the refNum set to CurResFile(). You
could rewrite it to use other than FSSpecs.
pr
--
Pete Resnick (...so what is a mojo, and why would one be rising?)
Graduate assistant - Philosophy Department, Gregory Hall, UIUC
System manager - Cognitive Science Group, Beckman Institute, UIUC
Internet: resnick@cogsci.uiuc.edu
OSErr RefNumToFSSpec(short refNum, FSSpecPtr fileSpec)
{
OSErr errCode;
FCBPBRec theFCB;
long myAttributes;
theFCB.ioCompletion = nil;
theFCB.ioNamePtr = fileSpec->name;
theFCB.ioVRefNum = 0;
theFCB.ioRefNum = refNum;
theFCB.ioFCBIndx = 0L;
errCode = PBGetFCBInfoSync(&theFCB);
fileSpec->vRefNum = theFCB.ioFCBVRefNum;
fileSpec->parID = theFCB.ioFCBParID;
if(TrapAvailable(_GestaltDispatch) && (Gestalt(gestaltFSAttr,
&myAttributes) == noErr) && (myAttributes & (1 << gestaltHasFSSpecCalls)))
FSMakeFSSpec(fileSpec->vRefNum, fileSpec->parID,
fileSpec->name, fileSpec);
return(errCode);
}
-=-=-=-=-=-=-=-=-=-=-==-
The answer came from Pete Resnick <resnick@cogsci.uiuc.edu>
Thanks, Pete!
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Jeff Garner Shoestring Software Products jgarner@seattleu.edu
(206) 232-1096 Mercer Island, Washington jgarner@visual.spk.wa.us
On 18 Dec 1992 asaria@rrdtc.donnelley.com wrote:
>
> Hello,
>
> I'm trying to open up a file in the same folder as my application. What's
> the best way to do this?
>
> I thought that if I could get an FSSpec for my application, then I could
> use the volume and directory information to construct an FSSpec for the
> file I want to open. This seemed pretty straightforward until I tried
> to find out how to get the FSSpec. I've checked the New-IM/Files, but
> didn't see how to do this.
>
> I'd appreciate any help on this.
>
> Thanks.
>
> Riyaz
Path: ucivax!gateway
From: resnick@cogsci.uiuc.edu (Pete Resnick)
Subject: Re: FSSpec for the running application
X-Sender: resnick@tarski.cogsci.uiuc.edu
Message-ID: <199212190702.AA01798@tarski.cogsci.uiuc.edu>
Newsgroups: fa.think-c
Lines: 40
Date: 19 Dec 92 07:02:52 GMT
At 7:46 PM 12/18/92 +0000, asaria@rrdtc.donnelley.com wrote:
>I thought that if I could get an FSSpec for my application, then I could
>use the volume and directory information to construct an FSSpec for the
>file I want to open. This seemed pretty straightforward until I tried
>to find out how to get the FSSpec. I've checked the New-IM/Files, but
>didn't see how to do this.
You could pass CurResFile() to the following routine:
OSErr RefNumToFSSpec(short refNum, FSSpecPtr fileSpec)
{
OSErr errCode;
FCBPBRec theFCB;
long myAttributes;
theFCB.ioCompletion = nil;
theFCB.ioNamePtr = fileSpec->name;
theFCB.ioVRefNum = 0;
theFCB.ioRefNum = refNum;
theFCB.ioFCBIndx = 0L;
errCode = PBGetFCBInfoSync(&theFCB);
fileSpec->vRefNum = theFCB.ioFCBVRefNum;
fileSpec->parID = theFCB.ioFCBParID;
if(TrapAvailable(_GestaltDispatch) &&
(Gestalt(gestaltFSAttr, &myAttributes) == noErr) &&
(myAttributes & (1 << gestaltHasFSSpecCalls)))
FSMakeFSSpec(fileSpec->vRefNum,
fileSpec->parID, fileSpec->name,
fileSpec);
return(errCode);
}
pr
--
Pete Resnick (...so what is a mojo, and why would one be rising?)
Graduate assistant - Philosophy Department, Gregory Hall, UIUC
System manager - Cognitive Science Group, Beckman Institute, UIUC
Internet: resnick@cogsci.uiuc.edu
Path: ucivax!gateway
From: D1620@applelink.apple.com ("Working SW, M Crawford,PAS")
Subject: About Word Services
Message-ID: <724759704.0245808@AppleLink.Apple.COM>
Newsgroups: fa.think-c
Lines: 84
Date: 19 Dec 92 10:23:25 GMT
I'd like to say a few words about the Word Services SDK that Mark Nagel kindly
posted on ics.uci.edu. (The file is /mac/think-c/demos/ws-sdk-1.0.hqx - it is
504K).
Word Services is an Apple Event protocol that allows any application to have
its text processed by an external speller, grammar checker, hyphenator, or
other text service as if it were a built in menu item. Working Software
developed the protocol in cooperation with our competitors in the spelling
business, as well as several grammar checker and word processor publishers and
Apple Computer.
This is a public protocol. No license fee or non-disclosure is required to use
it. The SDK is free, and you may use the source code on it for free.
With Word Services, every service that a user purchases will be available in
every application. You can provide for services such as spellchecking
without...
o paying any license fees
o debugging somebody else's wierd OEM speller code
o stripping features to save space
o taking up expensive space for dictionaries on your distribution disks.
o having to worry about foreign languages
The user has the added benefit of saving disk space by only having a single
dictionary for use by all programs, as well as a single user interface for each
service. Of coure more exotic services than spellers will be available before
long.
The SDK contains Writeswell Jr., a simple text editor that supports word
services, with complete source code, as well as a debugging version of our
spellchecker, a dictionary, and the protocol specification.
We have just released Spellswell 7, an update to our Spellswell spelling
checker that now supports Word Services. Spellers are under development in
German, French, and Turkish. It is supported on the client side by Fair
Witness from Chena Software. A number of other clients are under development
as well.
(The AppleScript Beta CD that Apple is sending to Apple Associates and Partners
lists some of the clients in the AppleScript Interactive Datasheet that is in
the Open Me First folder. The Word Services SDK is on the CD as well. Or you
can send six bucks for postage and handling to Working Software. Or come by
the office in Santa Cruz, I'll just give you the disk for free).
The sample code is also useful for any other Apple Event or AppleScript code.
Novice programmers will find the code useful as an example of how to support
common Macintosh application components such as:
o Windows
- resizing
- zooming
- moving
- scrolling
o Menus
- dynamic menus
- font menus
- style menus, including custom font sizes
- menu icons
o Preferences files
o Styled TextEdit
o Scroll bars
o Saving and reading files
- both data and resource forks
o Handling the Clipboard
o Printing
o Modal Dialogs
- scrolling lists in dialogs
- radio buttons
- check boxes
- editable text
- default button outlines
o Desk Accessory support
Sincerely,
Michael D. Crawford
Product Development Manager
Working Software, Inc.
740 Front Street #318
PO Box 1844
Santa Cruz, CA 95061-1844
d1620@applelink.apple.com
Path: ucivax!gateway
From: igorl@uiuc.edu (Igor Livshits)
Subject: Re: FSSpec for the running application
X-Sender: igorl@ncsa.uiuc.edu
Message-ID: <9212192113.AA06458@mars.ncsa.uiuc.edu>
Newsgroups: fa.think-c
Lines: 14
Date: 19 Dec 92 21:13:49 GMT
Pete's example:
>You could pass CurResFile() to the following routine:
>
>OSErr RefNumToFSSpec(short refNum, FSSpecPtr fileSpec)
Would this also be the best way to get the directory info for the current
application from within that application, or is there a better, faster way?
Thanks, igor
_____
NCSA-UIUC, e:igorl@uiuc.edu, p:(217) 244-5606
Path: ucivax!gateway
From: dnebing@andy.bgsu.edu
Subject: Programming group and the 32k barrier
Message-ID: <9212192330.AA18815@andy.bgsu.edu>
Newsgroups: fa.think-c
Lines: 53
Date: 19 Dec 92 23:30:49 GMT
TextEdit is limited to files smaller than 32k. Doesn't that suck!
Well, instead of complaining about the limits on TextEdit, I would like
to do something about it. I think there is a need for something that is
public-domain that can handle this problem, whether in the form of a
library or actual source code.
Now before you think about whipping out those flame-throwers and
thrashing me for not looking into other options, I want to tell you that
I have. These are my thoughts:
1) Existing PD or ShareWare editors: There is quite a range of these
that are available to anyone who can ftp them. And these are all
very good programs. While they are fine as editor in themselves,
there still is no way to handle the files greater than 32k by
your own application. You must either communicate directly with
the editor or trust the user to do all of the work. While this
can solve the problem, it becomes quite a hassle for the user to
be switching in and out of two apps. Also, if you implement the
communication with the application, you rely on the fact that
the author will not change the communication method. If it does
change, you have to change your app to keep up compatibility.
2) I know that there is a TCL class CPEditText which can handle files
greater than 32k. To use this, you are restricted to to using the
TCL.
3) I also know about the Word Solution Engine, a third party library
for handling files greater than 32k. This would be perfect, except
for the price.
4) There also exists the CAPPS library from Think that came out a
long time ago, but it is currently unsupported and I don't know
how to get my hands on it.
For these reasons, I would like to create something to fix these
problems. But since it is a large, somewhat complicated project, it
would probably be completed faster and easier as a group project.
If you are interested in being part of such a group, email me for
more details. The request for more information will not bind you in any
way to the group once it gets going.
For more info (or the inevitable flame;), email to:
dnebing@andy.bgsu.edu
Thanks,
Dave Nebinger
dnebing@andy.bgsu.edu
Path: ucivax!gateway
From: C2MXBAR@fre.towson.edu (Aaron Barnett)
Subject: cursor patch
Message-ID: <01GSK87440KI9S66A4@TOE.TOWSON.EDU>
Content-transfer-encoding: 7BIT
MIME-version: 1.0
Newsgroups: fa.think-c
X-VMS-To: TOE::IN%"think-c@ics.uci.edu"
Lines: 6
Date: 21 Dec 92 07:35:33 GMT
X-Envelope-to: think-c@ics.uci.edu
I want to change the std cursor(s) at start up. what's the best way?
I was thinking of patching setcursor(), but not all app maintain a cursor.
thanks
aaron
Path: ucivax!gateway
From: joshua@natural.com ("Joshua D. Wachs")
Subject: Re: Reminder
X-Sender: joshua@natural
Message-ID: <9212211531.AA04348@natural.com>
Newsgroups: fa.think-c
Lines: 50
Date: 21 Dec 92 16:56:40 GMT
Jim... regarding your message...
>Thanks for your message! "Natural Intelligence!" I could do with some of
>that!
If you'd like a T-Shirt, send $10 + s&h... :-) (Chris says you can just
bring us down there for a week and we'll deliver 1/2 dozen and NI mugs
t-shirts for free.
>My imediate problem is that I can't even get my version of the Reminder
>to compile!
>
>. . .
>
>GetDItem (dialog, iLaunchCheckBox, &itemType, &itemHandle, &itemRect);
>if (reminder->launch = GetCtlValue ((ControlHandle) itemHandle))
> reminder->notify.nmResp = &LaunchResponse;/* Pointer
>types don't match! */
>else
> reminder->notify.nmResp = &NormalResponse;/* Pointer
>types don't match! */
This one was quite the bitch... pardon my french. There are two ways
around this problem... the less "sexy" one is to change the options in the
edit menu. Go to "Language Settings" and uncheck "Check pointer types" in
the ANSI conformance box. I did this and it worked fine but it still
bothered me that it wouldn't be compilable. So we finally figured out that
the problem was the the nmResp field need a pointer type of NMProcPtr. If
you look in the "Notification.h" file, you'll see this is the case. You
need to change the two lines to the following...
if ( reminder->launch = GetCtlValue( (ControlHandle)itemHandle ) )
reminder->notify.nmResp = (NMProcPtr)&LaunchResponse;
else
reminder->notify.nmResp = (NMProcPtr)&NormalResponse;
This casts the pointer to type NMProcPtr... this should now compile
perfectly. If not, please let me know... Hope this helps other frustrated
"Primers."
-- Joshua
-----------------------------------------------------------------------------
NN N II Joshua D. Wachs | Internet: joshua@natural.com
N N N II President | Phone: 617-876-4876
N N N II Natural Intelligence, Inc. | FAX: 617-492-7425
N N N II 2067 Massachusetts Avenue | AppleLink: NATURAL
N NN II Cambridge MA 02140 | CompuServe: 72427,177
-----------------------------------------------------------------------------
Path: ucivax!gateway
From: k059509@hobbes.kzoo.edu ("Jason A. Bobier")
Subject: link errors
Message-ID: <9212220229.AA25672@hobbes.kzoo.edu>
X-Mailer: ELM [version 2.3 PL11]
Newsgroups: fa.think-c
Lines: 17
Date: 22 Dec 92 02:27:21 GMT
Hi there,
This should be a simple question to answer for those more experienced than
I.
I am using think c version 5.04, with object extensions on. When I attempt
to compile, I am getting link errors of the type
undefined: __noMethod (oopsDebug)
undefined: __noObject (oopsDebug)
Can anyone tell me why?
thanx,
Jason Bobier
k059509@kzoo.edu
The world would be a much better place if people would think.
Path: ucivax!gateway
From: D1620@applelink.apple.com ("Working SW, M Crawford,PAS")
Subject: Re: cursor patch
Message-ID: <724994371.4964992@AppleLink.Apple.COM>
Newsgroups: fa.think-c
Lines: 13
Date: 22 Dec 92 03:40:22 GMT
To change the cursors for all applications, edit the resources in the system
file to put in the cursors that you want.
I'm not sure if the cursors are kept as ROM resources. If so, you'll need to
override them, which can be done but requires setting some flag in a different
resource in the system.
This won't work if the application keeps its own cursors in its resource file,
but it will work for most applications.
Mike Crawford
Working Software, Inc
Path: ucivax!gateway
From: k059509@hobbes.kzoo.edu ("Jason A. Bobier")
Subject: link errors
Message-ID: <9212220544.AA05006@hobbes.kzoo.edu>
X-Mailer: ELM [version 2.3 PL11]
Newsgroups: fa.think-c
Lines: 10
Date: 22 Dec 92 05:41:37 GMT
Thanx to Jim Lynch & David Sugar.
I figured that out about 3 minutes after I sent the letter :-).
Is there any explanation for oopDebug's lack of these two procedures, or is
it just a practical joke by Symantec? :-)
Jason Bobier
k059509@kzoo.edu
The world would be a much better place if people would think.
Path: ucivax!gateway
From: k059509@hobbes.kzoo.edu ("Jason A. Bobier")
Subject: Re: link errors
Message-ID: <9212221813.AA25618@hobbes.kzoo.edu>
X-Mailer: ELM [version 2.3 PL11]
Newsgroups: fa.think-c
Lines: 13
Date: 22 Dec 92 19:16:41 GMT
> oopsDebug actually works... but you have to have certain #defines for it to
> work; otherwise the undefineds in oopsDebug are hooks for you to hook onto.
>
Could someone tell me where the #defines are documented? Or if not, what
they are?
thanx greatly,
Jason Bobier
k059509@kzoo.edu
The world would be a much better place if people would think.
Path: ucivax!gateway
From: k044477@hobbes.kzoo.edu ("Jamie R. McCarthy")
Subject: Checking class casting
Message-ID: <9212230003.AA09044@hobbes.kzoo.edu>
X-Mailer: ELM [version 2.3 PL11]
Newsgroups: fa.think-c
Lines: 73
Date: 23 Dec 92 00:01:12 GMT
If you're like me, you often write code like:
CMyFile *theFile;
theFile = (CMyFile*) aFunctionThatReturnsACFileObject();
ASSERT(member(theFile, CMyFile));
theFile->doSomething();
or:
CFile *theFile;
theFile = aFunctionThatReturnsACFileObject();
ASSERT(member(theFile, CMyFile));
((CMyFile*)theFile)->doSomething();
How about a macro that makes this a little easier, and optionally does
the assertion as well?
Drop this in your precompiled header (or anyplace you like):
/* A spiffy way of typecasting objects. */
#if defined(__TCL_DEBUG__) && !defined(__NO_TCL_ASSERTIONS__)
extern void *__ocastStorage;
#define ocast(c,o) \
( __ocastStorage = (void*) (o), \
(!member((CObject*)(__ocastStorage), c) ? \
(Failure(50, excMsgLookupFailed), 0) : 0), \
( (c*) (void*) ( ((char*)__ocastStorage) ) ) \
)
#else
#define ocast(c,o) \
((c*)(o))
#endif
...and drop this somewhere in a source file (say, GlobalVars.c):
#if defined(__TCL_DEBUG__) && !defined(__NO_TCL_ASSERTIONS__)
void *__ocastStorage;
#endif
...and write:
CFile *theFile;
theFile = ocast(CMyFile, aFunctionThatReturnsACFileObject());
theFile->doSomething();
or:
CFile *theFile;
theFile = aFunctionThatReturnsACFileObject();
ocast(CMyFile, theFile)->doSomething();
Note that the macro only evaluates the second expression once, so it is
safe to call with expressions that have side-effects.
When the object named is not of the proper type, the Failure() gets
called, and it should put up the "a method lookup failed. Could be a bad
cast or disposed object" error, which I figured was the most appropriate
one. Only use ocast() with real objects, don't blindly make every
typecast an ocast()--if you call ocast(CObject, NULL), for example,
you'll get an error.
The macro adds about 60 bytes of object code per call to my app. Your
mileage may vary.
By the way, __NO_TCL_ASSERTIONS__ is my own symbol that I #define when I
want full exception-handling but don't want ASSERT()s. I had to mess
with Exceptions.c and some other stuff to get it to be that way; if
anyone knows of an easier way, please let me know. Thanks.
--
Jamie McCarthy Internet: k044477@kzoo.edu AppleLink: j.mccarthy
"Apple developers will still have access to System 7.1 through the
monthly Developer CD series, but they may use it only for testing
and development purposes." - AppleDirect, Nov/Dec 92
Path: ucivax!gateway
From: jwachs@jpmorgan.com (Josh Wachs)
Subject: SetDialogDefaultItem
Message-ID: <9212231340.AA06976@mp670-sybase.ny.jpmorgan.com>
Newsgroups: fa.think-c
Lines: 28
Date: 23 Dec 92 13:40:46 GMT
Yet another C Primer (v1, 2 ed.) questions...
I have managed to get reminder to work but am still stumped
on the "SetDialogDefaultItem" command.
According to the book, when SetDialogDefaultItem is called as follows:
SetDialogDefaultItem( dialog, ok );
A border should be drawn around the OK button and enter should accept
the dialog. It doesn't. The same code also doesn't work in the next
chapter's ResWriter project.
I know filters are the way to go w/ dialogs but I would like to get this
to work "as advertised" if possible. Has anyone had any luck w/ this?
Thanks...
-- Joshua
-----------------------------------------------------------------------------
NN N II Joshua D. Wachs | Internet: joshua@natural.com
N N N II President | Phone: 617-876-4876
N N N II Natural Intelligence, Inc. | FAX: 617-492-7425
N N N II 2067 Massachusetts Avenue | AppleLink: NATURAL
N NN II Cambridge MA 02140 | CompuServe: 72427,177
-----------------------------------------------------------------------------
Path: ucivax!gateway
From: tempel@monmouth-etdl1.army.mil (George Tempel)
Subject: Re: SetDialogDefaultItem
Message-ID: <01GSNGYU270Y91VTDT@MONMOUTH-etdl1.Army.MIL>
Content-transfer-encoding: 7BIT
X-Mailer: LeeMail 1.2.4
Newsgroups: fa.think-c
Lines: 41
Date: 23 Dec 92 15:18:17 GMT
>Yet another C Primer (v1, 2 ed.) questions...
>
>I have managed to get reminder to work but am still stumped
>on the "SetDialogDefaultItem" command.
>
>According to the book, when SetDialogDefaultItem is called as follows:
>
>SetDialogDefaultItem( dialog, ok );
>
>A border should be drawn around the OK button and enter should accept
>the dialog. It doesn't. The same code also doesn't work in the next
>chapter's ResWriter project.
>
>I know filters are the way to go w/ dialogs but I would like to get this
>to work "as advertised" if possible. Has anyone had any luck w/ this?
>
>Thanks...
>
>-- Joshua
>
nope, i've been trying to use it to for about 6 months now off and on, and
still no luck. I've even seen an in-line assembler hack that's supposed to
work and doesn't. If you find an answer let me know.
>-----------------------------------------------------------------------------
>NN N II Joshua D. Wachs | Internet: joshua@natural.com
>N N N II President | Phone: 617-876-4876
>N N N II Natural Intelligence, Inc. | FAX: 617-492-7425
>N N N II 2067 Massachusetts Avenue | AppleLink: NATURAL
>N NN II Cambridge MA 02140 | CompuServe: 72427,177
>-----------------------------------------------------------------------------
>
"Oh no, not again..."--Douglas Adams
george f tempel
tempel@monmouth-etdl1.army.mil (144.252.1.1)
netromancr@aol.com (AmericaOnline)
Path: ucivax!gateway
From: jimlynch@netcom.com (Jim Lynch)
Subject: Re: link errors
Message-ID: <9212231938.AA11917@netcom2.netcom.com>
Newsgroups: fa.think-c
Lines: 8
Date: 23 Dec 92 19:39:56 GMT
In your _prefix_, you should add the line
#define __TCL_DEBUG__ 1
Also, if you use a precompiled header file including MacHeaders and the headers
of TCL, you must re-precompile it (or build a separate one like I did).
BTW, building a precompiled header file w/ tcl headers is highly recommended.
Path: ucivax!gateway
From: jimlynch@netcom.com (Jim Lynch)
Subject: Re: Checking class casting
Message-ID: <9212231941.AA12049@netcom2.netcom.com>
Newsgroups: fa.think-c
Lines: 2
Date: 23 Dec 92 19:42:52 GMT
Jamie mentions GlobalVars.c... GlobalVars.h is also useful (but missing, so I
made my own)
Path: ucivax!gateway
From: jimlynch@netcom.com (Jim Lynch)
Subject: Re: SetDialogDefaultItem
Message-ID: <9212231950.AA12477@netcom2.netcom.com>
Newsgroups: fa.think-c
Lines: 1
Date: 23 Dec 92 19:51:47 GMT
use tcl! it does everything you want to do and more...
Path: ucivax!gateway
From: nagel@ics.uci.edu (Mark Nagel)
Subject: ARCHIVE: AutoGuest patches
Message-ID: <5843.725146473@ics.uci.edu>
Newsgroups: fa.think-c
Reply-To: think-c-request@ics.uci.edu
Lines: 27
Date: 23 Dec 92 21:34:42 GMT
Date: Tue, 22 Dec 92 10:17:19 -0500
From: MIKOLIC-TORREI I <iom@dsunx1.dsrd.ornl.gov>
Subject: Submission: AutoGuest patches
This file contains the AutoGuest patches.
The AutoGuest patches allow your code to send an AppleEvent to
a remote Mac without any user interaction IF THE REMOTE MAC
ALLOWS <GUEST> TO PROGRAM LINK.
These patches are the ONLY way a background-only program can
send AppleEvents to a remote Mac.
This file includes both an INIT to install the patches at
start-up, and an MPW .o file containing the patches in
a form suitable for installing them from your code.
Documentation and an example are included.
These were provided to me by Jon Pugh <jpugh@apple.com>, and
are posted to the archive with his permission.
Igor Mikolic-Torreira
igormt@alumni.caltech.edu
[saved as: /mac/think-c/system/autoguest.hqx; 11K]
Path: ucivax!gateway
From: jharland@dogbox.acme.gen.nz (Jim Harland)
Subject: Menus
Message-ID: <ueT0VB1w165w@dogbox.acme.gen.nz>
Content-Transfer-Encoding: 8bit
Comments: Usenet User
Content-Type: text/plain; charset=ISO-8859-1
Mime-Version: 1.0
Newsgroups: fa.think-c
Organization: The Dawghaus BBS, Palmerston North, New Zealand (+64 6 357 9245)
Content-Description: Untagged text converted to MIME.
Lines: 63
Date: 24 Dec 92 05:07:33 GMT
Hi! I'm Jim Harland. This is my first posting.
I'm affraid I'm still both C and Toolbox naive.
My immediate problem is that I'm affecting some modifications to the
NewClassDemo that comes with THINK C 5.0, and I can't get the menus to
behave as I believe they should.
I've attached the original "Font", "Size", and "Style" menus as submenus
to the bottom of the "Edit" menu. (I'm not certain that this conforms
with Apple's user interface guidelines, and would be happy to receive
comment on this!) I've created or modified resources for a total of
eleven menus (including "Apple", "File", and "Edit"). Three of the seven
menus that can be pulled down from the menubar have submenus. All of my
menus and submenus pull down just fine.
I've associated numbers with all of my menu items (e.g., "New Record#123"
in ResEdit) and defined these numbers in the Commands.h header file
(e.g., #define cmdNR 200L). To make sure that my menu
items actually call the requisit commands before I set about writing the
commands themselves - i.e., to make sure that I have "hooks" to attach
those commands to) I created a single dialog box and used the switch
statement in the DoCommand routine in CDemoApp.c to associate my new
dialog box with each of my commands and hense to call it when any of my
new menu items are selected.
Only the three (almost) standard menus (Apple, File, and Edit) that I
"borrowed" from the NewClasDemo behave properly. Through a process
involving much too much trial and error I've discovered that each of my
new menus thinks it's one of the other (original, and now sub-) menus.
Despite the fact that a particular menu item reads say
"New Record" and has "#123" appended to its title in the appropriate
resource file, and despite the fact that cmdNR is defined as a constant
having the value of 123 and subsequently calls my new dialog box, this
item might (consistantly) call the precedure associated with the first
item in say the original File menu.
What have I done wrong?
I have only 1 MBAR resource. Its ID is "1" as per the instructions in the
manuals.
Do I have somehow to inform the compiler that there are 4 new menus in
the menubar? Shouldn't it figure this out?
Perhaps the numbers I defined are out of range, or are reserved. What's
the range?
Perhaps there is an object the mediates the application's response to
menu selection. Maybe the DoCommand routine in CDemoApp.c isn't the place
to trap menu item selection!
Hellllpppppppp!!!!!!!!!!!!!"!!!
And have a very merry Christmas!
Jim
jharland@dogbox.acme.gen.nz
--
jharland@dogbox.acme.gen.nz (Jim Harland)
The Dawghaus BBS, Palmerston North, New Zealand (+64 6 357 9245)
Caller number 5058 Posting number: 1509 MD-DOS Waffle version 1.65
Path: ucivax!gateway
From: jimlynch@netcom.com (Jim Lynch)
Subject: Re: menus
Message-ID: <9212241103.AA28973@netcom2.netcom.com>
Newsgroups: fa.think-c
Lines: 37
Date: 24 Dec 92 11:04:57 GMT
I was scratching my head until you mentioned reserved command numbers. You're
right, the TCL reserves the commands in the range 1 to 1023 (THINK C OOP manual
page 193).
While the command (eventually) gets to your subclass of CApplication, there is
a special object that is responsable for storing the command numbers of menus
and which you must inform of your hierarchical menus. This object class is the
CBartender. To learn about it, see THINK C OOP manual starting on page 191.
Discussion of hierarchical menus starts on page 196, basic info follows:
You can set up hierarchical menus in your resource file, but you need to be
aware of the special use for the command key and item mark fields in the menu
data structure. In the TCL, special meaning is attached to the command key
equivalent field and the item mark field of the menu item to which your
hierarchical menu will attach. The item mark field of this menu item should
contain the resource ID of your hierarchical menu and command key equivalent
field of the menu item should contain the hex value 1B, or control-[. Remember
that the menu item that should have these special values is the one you want
to pop up your hierarchical menu.
It is possible to have a hierarchil menu introduced to the CBartender. To make
this introduction, send the CBartender a 'InsertHierMenu()' message. The (one
and only) CBartender's address is in the global variable 'gBartender', so the
message could be sent like this:
'gBartender->InsertHierMenu
(
MenuResourceID,
dimCommandNumbe^R
dimCommandNumber,
fromWhichMenuResourceID,
afterWhichItem
) ;' (without the quotes.)
An example is provided on page 197. Good luck.
-Jim
Path: ucivax!gateway
From: jharland@dogbox.acme.gen.nz (Jim Harland)
Subject: Menus
Message-ID: <e0TBwB1w165w@dogbox.acme.gen.nz>
Content-Transfer-Encoding: 8bit
Comments: Usenet User
Content-Type: text/plain; charset=ISO-8859-1
Mime-Version: 1.0
Newsgroups: fa.think-c
Organization: The Dawghaus BBS, Palmerston North, New Zealand (+64 6 357 9245)
Content-Description: Untagged text converted to MIME.
Lines: 63
Date: 25 Dec 92 08:11:03 GMT
Hi! I'm Jim Harland. This is my first posting.
I'm affraid I'm still both C and Toolbox naive.
My immediate problem is that I'm affecting some modifications to the
NewClassDemo that comes with THINK C 5.0, and I can't get the menus to
behave as I believe they should.
I've attached the original "Font", "Size", and "Style" menus as submenus
to the bottom of the "Edit" menu. (I'm not certain that this conforms
with Apple's user interface guidelines, and would be happy to receive
comment on this!) I've created or modified resources for a total of
eleven menus (including "Apple", "File", and "Edit"). Three of the seven
menus that can be pulled down from the menubar have submenus. All of my
menus and submenus pull down just fine.
I've associated numbers with all of my menu items (e.g., "New Record#123"
in ResEdit) and defined these numbers in the Commands.h header file
(e.g., #define cmdNR 200L). To make sure that my menu
items actually call the requisit commands before I set about writing the
commands themselves - i.e., to make sure that I have "hooks" to attach
those commands to) I created a single dialog box and used the switch
statement in the DoCommand routine in CDemoApp.c to associate my new
dialog box with each of my commands and hense to call it when any of my
new menu items are selected.
Only the three (almost) standard menus (Apple, File, and Edit) that I
"borrowed" from the NewClasDemo behave properly. Through a process
involving much too much trial and error I've discovered that each of my
new menus thinks it's one of the other (original, and now sub-) menus.
Despite the fact that a particular menu item reads say
"New Record" and has "#123" appended to its title in the appropriate
resource file, and despite the fact that cmdNR is defined as a constant
having the value of 123 and subsequently calls my new dialog box, this
item might (consistantly) call the precedure associated with the first
item in say the original File menu.
What have I done wrong?
I have only 1 MBAR resource. Its ID is "1" as per the instructions in the
manuals.
Do I have somehow to inform the compiler that there are 4 new menus in
the menubar? Shouldn't it figure this out?
Perhaps the numbers I defined are out of range, or are reserved. What's
the range?
Perhaps there is an object the mediates the application's response to
menu selection. Maybe the DoCommand routine in CDemoApp.c isn't the place
to trap menu item selection!
Hellllpppppppp!!!!!!!!!!!!!"!!!
And have a very merry Christmas!
Jim
jharland@dogbox.acme.gen.nz
--
jharland@dogbox.acme.gen.nz (Jim Harland)
The Dawghaus BBS, Palmerston North, New Zealand (+64 6 357 9245)
Caller number 5080 Posting number: 1509 MD-DOS Waffle version 1.65
Path: ucivax!gateway
From: russne@catseq.catlin.edu (Russ Nelson)
Subject: A little problem
Message-ID: <Pine.2.27-experimental.9212270945.A22927@catseq.catlin.edu>
Content-Type: TEXT/PLAIN; charset=US-ASCII
Mime-Version: 1.0
Newsgroups: fa.think-c
Lines: 21
Date: 27 Dec 92 18:00:06 GMT
See if you can help me out on this.
Handle copyCount;
copyCount = NewHandle(sizeof(short));
/* Make a new handle for the number of items in the clipboard */
HLock(copyCount);
(**copyCount) = (char)ScrapInfo.scrapCount;
HUnlock(copyCount);
AddResource(copyCount, 'TCnt', 256, "\pYesterday's DJIA");
/* Save the count to the file */
if((resErr = ResError())) goto finish;
resErr comes out as -194, which according to System Errors DA is
addResource failed (real helpful, Apple!). I'd appreciate any insight.
Thanks in advance.
Russ Nelson * internet: russne@catseq.catlin.edu * bitnet: nelson@catlin
->This came directly from a computer and is not to be doubted or disbelieved.<-
Path: ucivax!gateway
From: dmorley@clam.rutgers.edu (darin s morley)
Subject: Programming in SANE
Message-ID: <CMM-RU.1.3.725500964.dmorley@clam.rutgers.edu>
Newsgroups: fa.think-c
Lines: 5
Date: 28 Dec 92 00:02:54 GMT
i want to convert some math functions to SANE and try to standardize my
numerical code in it as well. is there an easy way to learn more about SANE?
is there a book on using SANE with Think C?
dmorley@clam.rutgers.edu
Path: ucivax!gateway
From: andreas_morgen@sfu.ca
Subject: Resource Compression
Message-ID: <9212281639.AA04579@whistler.sfu.ca>
Newsgroups: fa.think-c
Lines: 4
Date: 28 Dec 92 16:40:08 GMT
Is there an application availble to compress resources like Apple does with
the
operating system.
Path: ucivax!gateway
From: russne@catseq.catlin.edu (Russ Nelson)
Subject: Re: A Little Problem
Message-ID: <Pine.2.27-experimental.9212281147.A26984@catseq.catlin.edu>
Content-Type: TEXT/PLAIN; charset=US-ASCII
Mime-Version: 1.0
Newsgroups: fa.think-c
Lines: 11
Date: 28 Dec 92 19:58:37 GMT
Several people have responded to my problem, saying that I need to open a
resource file with write permissions. Unfortunately, that's not the
problem. I neglected to say that in the same code, before the segment I
posted, I opened a prefs file in the preferences folder on the current
system disk, and already wrote another resource to it, which I got no
error message for. Wierd. Thanks again.
Russ Nelson * internet: russne@catseq.catlin.edu * bitnet: nelson@catlin
->This came directly from a computer and is not to be doubted or disbelieved.<-
Path: ucivax!gateway
From: jimlynch@netcom.com (Jim Lynch)
Subject: Re: A Little Problem
Message-ID: <9212290341.AA06948@netcom2.netcom.com>
Newsgroups: fa.think-c
Lines: 23
Date: 29 Dec 92 03:42:02 GMT
russne@catseq.catlin.edu (Russ Nelson) said:
>>>>>
Several people have responded to my problem, saying that I need to open a
resource file with write permissions. Unfortunately, that's not the
problem. I neglected to say that in the same code, before the segment I
posted, I opened a prefs file in the preferences folder on the current
system disk, and already wrote another resource to it, which I got no
error message for. Wierd. Thanks again.
<<<<<
Russ,
Are you still having problems? Look at _all_ of the code that gets excecuted
between the first AddResource (the successful one) and the unsuccessful one.
Step thru the code using your favorite debugger. You're looking for any calls
that might affect the open-ness or the current-ness (but any other ness except
Elliott :) of the file you wish to write to. Still having problems? Watch the
value of CurMap (current resource file number, _old_ inside mac v.1 pg I-116)
in the debugger while you step and watch the variable for a change. If you
find that CurMap changes, repeat the process and step into the procedure that
caused the change (or add code which makes the file current before adding the
resource).
Path: ucivax!gateway
From: P30WCC9%NIU.bitnet@uicvm.uic.edu (WES COVALT)
Subject: HyperCard XWindow
Message-ID: <9212282022.aa20855@q2.ics.uci.edu>
Newsgroups: fa.think-c
Lines: 13
Date: 29 Dec 92 04:22:08 GMT
Hello,
I am having difficulty in creating a HyperCard external window.
I can get the window to appear, but I can't draw to it, nor can
I close it properly. I do know that I am recieving events, e.g.
mouseDown and xWitinWindow, and I can move the window about the
screen.
I would greatly appreciate an example or framework from
someone.
Thanks,
Wes
PS: The window is in the floating level, if it make a difference.
Path: ucivax!gateway
From: k059509@hobbes.kzoo.edu ("Jason A. Bobier")
Subject: modifying default text & size
Message-ID: <9212290708.AA17270@hobbes.kzoo.edu>
X-Mailer: ELM [version 2.3 PL11]
Newsgroups: fa.think-c
Lines: 24
Date: 29 Dec 92 07:05:53 GMT
Hi there,
I am trying to modify the default font type & size that the TC editor uses.
The default that it comes with in Monaco 9, and I would like to change it to
Monaco 10 so that I can distinguish between 0 and O, 1 and l, etc. I have a
TT version of Monaco that does this, but does not work for Monaco 9. I
believe that this means that Monaco 9 exists as a bitmapped font somewhere
in the system.
According to the TC manual pg 134, to change the default font, one modifies
the CNFG resource with ID 0. However, the modification rules must be
incorrect since the 1st 4 words are 0000s, with the next 4 containing data
that does not seem to correspond to anything, and the last 4 again being
0000s.
Could someone please tell me how to either eliminate the bitmapped Monaco 9
(which does not appear in the system suitcase), or how to change the CNFG
resource.
thanx,
Jason Bobier
k059509@kzoo.edu
The world would be a much better place if people would think.
Path: ucivax!gateway
From: D1620@applelink.apple.com ("Working SW, M Crawford,PAS")
Subject: Debugging resources
Message-ID: <725614567.1112115@AppleLink.Apple.COM>
Newsgroups: fa.think-c
Lines: 38
Date: 29 Dec 92 07:45:34 GMT
Try using ResErrProc. This code will break into the debugger if you have a
resource manager error:
pascal void MyProc(void )
{
DebugStr("\pThere has been a resource error" );
}
void InstallDebugProc(void)
{
ResErrProc = (long)MyProc; /* Or maybe (ProcPtr)MyProc */
}
void RemoveDebugProc(void)
{
ResErrProc = (long)0;
}
After calling InstallDebugProc, any resource manager errors will cause a break
into the debugger. If you step out of MyProc(), you will eventually come to
the call where the error actually occurred.
This may not work well with a source level debugger. Use Macsbug.
Also, don't ship a product with this code in it.
Finally, there are some resource manager calls that cause errors on purpose. I
think some of the font manager routines do this when searching for a particular
font size that is not installed.
Mike Crawford
Product Development Manager
Working Software, Inc.
PS. Always check the return value of ResError() after making any resource
calls. Lots of them do not return result codes directly; you have to call
ResError() to find out.
Path: ucivax!gateway
From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
Subject: modifying default text & size
Message-ID: <9212291358.AA27353@chaos.cs.brandeis.edu>
In-Reply-To: "Jason A. Bobier"'s message of 29 Dec 92 07:05:53 GMT <9212290708.AA17270@hobbes.kzoo.edu>
Newsgroups: fa.think-c
Lines: 17
Date: 29 Dec 92 13:58:57 GMT
>>>>> On 29 Dec 92 07:05:53 GMT, "Jason A. Bobier" <k059509@hobbes.kzoo.edu> said:
> According to the TC manual pg 134, to change the default font, one
> modifies the CNFG resource with ID 0. However, the modification
> rules must be incorrect since the 1st 4 words are 0000s, with the
> next 4 containing data that does not seem to correspond to
> anything, and the last 4 again being 0000s.
The manual is correct. The zeros indicate that THINK C should use its
builtin default font and tab setting, which is Monaco 9, 4 spaces per
tab. If you change the zeros, you'll get the expected results.
-phil
----
Phil Shapiro Software Engineer
Language Products Group Symantec Corporation
Internet: phils@cs.brandeis.edu
Path: ucivax!gateway
From: k059509@hobbes.kzoo.edu ("Jason A. Bobier")
Subject: Programming fonts
Message-ID: <9212291747.AA05441@hobbes.kzoo.edu>
X-Mailer: ELM [version 2.3 PL11]
Newsgroups: fa.think-c
Lines: 9
Date: 29 Dec 92 17:45:13 GMT
Hey, what fonts do you guys use for programming? I am interested in one that
is easily read, like Monaco 9, but with all unique letters.
thanx,
Jason Bobier
k059509@kzoo.edu
The world would be a much better place if people would think.
Path: ucivax!gateway
From: evans@natural.com (Christopher Evans)
Subject: Trapping TEKey
Message-ID: <9212291738.AA14033@natural.com>
Newsgroups: fa.think-c
Lines: 22
Date: 29 Dec 92 18:03:54 GMT
I am having a problem when patching TEKey. The problem is that
if I remap the passed in control key to another key and the position
of the cursor moves, the old cursor sometimes remains visible and the
screen begins to fill up with old vertical bar cursors. Why is this
happenning? It happens whether I remap the key and continue with the TEKey
trap of if I abort the trap and call TESetSelect with a new selection area
from one number to itself. I seem to remember hearing someone talk about
this before. Can you offer any assistance?
<==================================Q======================================>
Chris Evans | Internet: evans@natural.com
Development | Phone: 617-876-4876
Natural Intelligence, Inc. | FAX: 617-492-7425
2067 Massachusetts Avenue | AppleLink: NATURAL
Cambridge MA 02140 | or evans@natural.com@INTERNET#
There's no real need to do housework -- after four years it doesn't get
any worse.
Path: ucivax!gateway
From: D1620@applelink.apple.com ("Working SW, M Crawford,PAS")
Subject: Re: Trapping TEKey
Message-ID: <725738870.0491156@AppleLink.Apple.COM>
Newsgroups: fa.think-c
Lines: 16
Date: 30 Dec 92 18:21:04 GMT
Could you have tail patched TEKey? If so, you might have broken a bug fix to
the system software.
See if you can make a patch in which you JMP, not JSR to the real TEKey at the
end of your patch. I know this might not be what you really want to do - but
if TEKey starts working, it's a tail patch problem.
There are bug fixes in the ROMS in which some traps look up the stack to see
who called them. If they were called from certain ROM addresses, they do
something different, resulting in fixing a bug that was in the caller's code.
Quite a hack. There's some intelligent reason that Apple did this, but it
escapes me at the moment.
Mike Crawford
Working Software, Inc.
Path: ucivax!gateway
From: winter@ai.rl.af.mil (Jim Wintermyre)
Subject: Re: Trapping TEKey (Tail-patching)
Message-ID: <9212302150.AA04106@AI.RL.AF.MIL>
Newsgroups: fa.think-c
Lines: 33
Date: 30 Dec 92 22:00:22 GMT
> Could you have tail patched TEKey? If so, you might have broken a bug fix to
> the system software.
>
> See if you can make a patch in which you JMP, not JSR to the real TEKey at the
> end of your patch. I know this might not be what you really want to do - but
> if TEKey starts working, it's a tail patch problem.
>
> There are bug fixes in the ROMS in which some traps look up the stack to see
> who called them. If they were called from certain ROM addresses, they do
> something different, resulting in fixing a bug that was in the caller's code.
> Quite a hack. There's some intelligent reason that Apple did this, but it
> escapes me at the moment.
Just a note on tail-patching - apparently it's safe to tail-patch ANY trap if
you're using SYSTEM 7, EXCEPT for FINDWINDOW. This came up on
comp.sys.mac.programmer a month or two ago. I think it might've been Dean Yu
who posted it, but in any case it was someone from Apple. System 7 has some
"magic" which allows it to determine when a trap has been tail-patched, and take
the appropriate action.
Also, I think that "intelligent reason" for Apple doing the bug fixes the way
you describe is that it allowed them to just write a small amount of code to fix
a ROM bug, rather than re-write the entire ROM routine (also note that these are
bug fixes TO the ROMs, not IN the ROMs). For example, instead of rewriting the
entire MenuSelect trap because of a one-line bug, they might patch some OTHER
trap that MenuSelect calls. They look at the return address and if it is in the
ROM (ie called by the bad MenuSelect) they do something that fixes whatever the
bug was, as you described. This saves a lot of space in system code and RAM.
Jim W.
winter@ai.rl.af.mil
wintermyrej@lonex.rl.af.mil
Path: ucivax!gateway
From: jimlynch@netcom.com (Jim Lynch)
Subject: Re: Trapping TEKey (Tail-patching)
Message-ID: <9212310018.AA00872@netcom2.netcom.com>
Newsgroups: fa.think-c
Lines: 8
Date: 31 Dec 92 00:18:05 GMT
"If builders built buildings the way programmers wrote programs,
the first woodpecker that came along would have destroyed civilization."
If the person who came up with the idea of checkking return addresses
instead of fixing the original problem built any buildings I inspected,
I'd slap that person with a million dollar fine and tell him not to play
on the freeway if he has never done so (but if he had, I'd ask him to
remove his blindfold first).
Path: ucivax!gateway
From: D1620@applelink.apple.com ("Working SW, M Crawford,PAS")
Subject: Re: Trapping TEKey
Message-ID: <725829131.5922284@AppleLink.Apple.COM>
Newsgroups: fa.think-c
Lines: 26
Date: 31 Dec 92 19:15:34 GMT
Chris,
Even though what you intend is a head patch, if you use a JSR at the end, then
it looks like a head patch to the ROM bug-fix code (technically known as
"come-from patches"). This is because the patch code looks at return addresses
on the stack.
Yes, you should UNLK. It's tricky, because you also need to have the stack
look just like it was when your code was called, because when TEKey does its
return, it will return to the function that called you.
I don't know whether TEKey is "come-from" patched. Just a suspicion.
There may be another solution other than patching traps. Even though you just
mean to patch the traps for your application, you also patch them for all the
desk accessories on system 6 Unifinder - it may not have the desired effect.
If you want to do something to an EditText field in a dialog, use a filterProc.
You can change the contents of the event record in a filter proc to change the
key codes.
Only patch traps when you really, really have to. They're a pain to keep
working. Believe me - most of my products are patches!
Mike Crawford
Working Software
Path: ucivax!gateway
From: winter@ai.rl.af.mil (Jim Wintermyre)
Subject: Re: Trapping TEKey
Message-ID: <9212312051.AA06017@AI.RL.AF.MIL>
Newsgroups: fa.think-c
Lines: 40
Date: 31 Dec 92 21:01:17 GMT
Hi! You wrote,
> Chris,
>
> Even though what you intend is a head patch, if you use a JSR at the end, then
> it looks like a head patch to the ROM bug-fix code (technically known as
> "come-from patches"). This is because the patch code looks at return
addresses
> on the stack.
> Yes, you should UNLK. It's tricky, because you also need to have the stack
> look just like it was when your code was called, because when TEKey does its
> return, it will return to the function that called you.
I guess you mean "it looks like a TAIL-patch to the ROM..." Anyway, did you see
my posting yesterday? You don't need to worry about it at all in system 7,
except for if you patch FindWindow. If this has to work under system 6, then
you do have to worry about the UNLK ugliness.
> I don't know whether TEKey is "come-from" patched. Just a suspicion.
There was a good discussion of this in Scott Knaster's "Macintosh Programming
Secrets," the 2nd edition. Basically, a trap won't be come-from patched unless
it will be called by the ROM. If a trap that needs to be fixed isn't called by
the ROM, it will have to be completely replaced by a fixed RAM version. Of
course, it doesn't make any sense to patch a trap that is already in RAM - just
release system 7.1.1a2!! Anyway, I doubt that TEKey is come-from patched, since
I can't think of any reason the ROM would be calling it.
> Only patch traps when you really, really have to. They're a pain to keep
> working. Believe me - most of my products are patches!
Isn't that the truth! But hey, it's so much fun...
Later,
Jim
winter@ai.rl.af.mil
wintermyrej@lonex.rl.af.mil